Sie sind auf Seite 1von 20

HANOI UNIVERSITY OF SCIENCE AND TECHNOLOGY

SCHOOL OF ELECTRONICS AND


TELECOMMUNICATION

REPORT
FOUR LEVEL QUADRATURE AMPLITUDE
MODULATION (4-QAM)

- Bi Vit Trng Giang MSSV: 20131088

- Trn Mnh Tun MSSV: 20134338

- Ng Ch Trung MSSV: 20134156

Class: Electrical Electronic Engineering K58

HaNoi, 09/11/2016

1
Table of Contents
I. Introduction ..................................................................................................................................... .3
II. Definition............................................................................................................................................ 3
1. QAM ..................................................................................................................................................... 3
2. Four level QAM (4-QAM) ................................................................................................................... 3
III. 4-QAM Modulation ......................................................................................................................... 4
IV. 4-QAM Demodulation...................................................................................................................... 7
V. 4-QAM Modulation/Demodulation simulation (using Matlab) .................................................... 7
1.Code ....................................................................................................................................................... 7
2. Result .................................................................................................................................................. 10
VI. Bit error rate (BER) ...................................................................................................................... 11
1. BER theory ......................................................................................................................................... 11
2. BER simulation using Matlab and comparing with theory................................................................. 13
VII. Signal error rate ........................................................................................................................... 15
1. SER theory. ......................................................................................................................................... 15
2. SER simulation by using Matlab and comparing with theory ............................................................ 17
VIII. CONCLUSION ........................................................................................................................... 19

2
I. Introduction
With the fast development of modern communication techniques, the demand
for reliable high date rate transmission is increased significantly, which stimulate much
interest in modulation techniques. Different modulation techniques allow you to send
different bits per symbol and thus achieve different throughputs or efficiencies. QAM
is one of widely used modulation techniques because of its efficiency in power and
bandwidth. In QAM system, two amplitude-modulated (AM) signals are combined into
a single channel, there by doubling the effective bandwidth.
The QAM is one of the adaptive modulation techniques that are commonly used for
wireless communications. Different order modulations allow sending more bits per symbol
and thus achieving higher throughputs or better spectral efficiencies. This method of
modulation has the advantage of reducing or eliminating intermodulation interference
caused by a continuous carrier near the modulation sidebands.

II. Definition
1. QAM
Quadrature amplitude modulation (QAM) is both an analog and a digital
modulation scheme. It conveys two analog message signals, or two digital bit streams, by
changing the amplitudes of two carrier waves, using the amplitude-shift keying (ASK)
digital modulation scheme or amplitude modulation (AM) analog modulation scheme
These two waves, usually sinusoids, are out of phase with each other by 90 and
are thus called Quadrature carriers or Quadrature components hence the name of the
scheme. The modulated waves are summed, and the resulting waveform is a combination
of both phase-shift keying (PSK) and amplitude-shift keying, or in the analog case of
phase modulation (PM) and amplitude modulation. In the digital QAM case, a finite
number of at least two phases, and at least two amplitudes are used. PSK modulators are
often designed using the QAM principle, but are not considered as QAM since the
amplitude of the modulated carrier signal is constant.

2. Four level QAM (4-QAM)


4-QAM consists of four unique combinations of phase and amplitude. Each
combination is assigned a 2-bit digital pattern. For example, suppose you want to
generate the bit stream (1,0,0,1,1,1). Because each symbol has a unique 2-bit digital
3
pattern, these bits are grouped in twos so that they can be mapped to the corresponding
symbols. In our example, the original bit stream (1,0,0,1,1,1) is grouped into the three
symbols (10,01,11).

These combinations are shown as the white dots on the constellation plot in Figure
2.1.4 The red lines represent the phase and amplitude transitions from one symbol to
another. Labeled on the constellation plot is the digital bit pattern that each symbol
represents. Thus, a digital bit pattern can be sent over a carrier signal by generating
unique combinations of phase and amplitude.

Figure 2.1 4-QAM symbol map

III. 4-QAM Modulation

The QAM modulation scheme encodes data by varying both amplitude and phase
of the carrier signal. Thus, it is sometimes viewed as a combination of ASK and PSK
modulation. A more fundamental way of viewing QAM thought is that it encodes data by
varying the amplitude of two carrier signals that are in-quadrature (phase difference of
90). Mathematically, 4-ary QAM is described by

( ) = cos(2 + )

Quadrature amplitude modulation is a modulation scheme that creates a


modulation signal from a binary bit stream. The binary data is broken up into bit sets.
Each bit set is represented on a constellation. The position of the point on the
constellation representing the bit set is mapped to In-phase and Quadrature components
using the complex envelope. The complex envelope can be expressed as:
4
( ) = ( ) + ()
In above equation, () represents the in-phase and () represents the quadrature
component. Since the QAM in the software was at baseband frequencies, mixing of the in-
phase and quadrature parts of the QAM symbol was not needed. However, for transmission
of a QAM symbol it must be mixed to higher frequencies for transmission, and can be
represented as:

20 20
( ) = cos(2 t) cos(2 t)

= cos(2 ) sin(2 )

20 20
Where = = cos() = = sin()

Using the complex In the case of a QAM square constellation, the pairs of
coordinates from a square matrix as shown by:

( + 1, 1) ( + 3, 1) . ( 1, 1)
( + 1, 3) ( + 3, 3) ( 1, 3)
. . .
{ , } =
. . .
. . .
[( + 1, + 1) ( + 3, + 1) ( 1, + 1)]

Where =

For 4-QAM, we have:

(1,1) (1,1)
{ , } = [ ]
(1, 1) (1, 1)

Using the complex envelope notation, a 4 level QAM constellation was used
to represent the combinational pairs of binary values.

5
Figure 3.1 4 level QAM constellation

The block diagram of 4-QAM demodulation

Figure 3.2 Block diagram of 4-QAM modulation

First the flow of bits to be transmitted is split into two equal parts: this process
generates two independent signals to be transmitted. They are encoded separately just like
they were in an amplitude-shift keying (ASK) modulator. Then one channel (the one "in
phase") is multiplied by a cosine, while the other channel (in "Quadrature") is multiplied
by a sine. This way there is a phase of 90 between them. They are simply added one to the
other and sent through the real channel.

6
IV. 4-QAM Demodulation

Figure 4.1 Block diagram of 4-QAM demodulation

Multiplying by a cosine (or a sine) and by a low-pass filter it is possible to extract


the component in phase (or in Quadrature). Then there is only an ASK demodulator and
the two flows of data are merged back.

V. 4-QAM Modulation/Demodulation simulation (using Matlab)


1.Code
%>>>>>>>>>>>>>>>>>> Matlab code for 4 ary-QAM modulation >>>>>>>>>>>>>>>>>%

clc;
clear all;
close all;

M=4;
%M=input(' enter the value of M array for QAM modulation : ');
fprintf('\n\n\n');
%XXXXXXXXXXXXXXXXXXXXXXXXXXX input chaking loop XXXXXXXXXXXXXXXXXXXXXXXXXX
Ld=log2(M);
ds=ceil(Ld);
dif=ds-Ld;
if(dif~=0)
error('the value of M is only acceptable if log2(M)is an integer');
end

%XXXXXXXXXXXXXXXXXXX binary Information Generation XXXXXXXXXXXXXXXXXXXXXXXX


nbit=16; %number of information bits
msg=round(rand(nbit,1)); % information generation as binary form
disp(' binary information at transmitter ');
disp(msg);
fprintf('\n\n');

%XX representation of transmitting binary information as digital signal XXX

7
x=msg;
bp=.000001; % bit period
bit=[];
for n=1:1:length(x)
if x(n)==1;
se=ones(1,100);
else x(n)==0;
se=zeros(1,100);
end
bit=[bit se];

end
t1=bp/100:bp/100:100*length(x)*(bp/100);
figure(1)
subplot(3,1,1);
plot(t1,bit,'lineWidth',2.5);grid on;
axis([ 0 bp*length(x) -.5 1.5]);
ylabel('amplitude(volt)');
xlabel(' time(sec)');
title('transmitting information as digital signal');

% binary information convert into symbolic form for 4-array QAM modulation
M=M; % order of QAM modulation
msg_reshape=reshape(msg,log2(M),nbit/log2(M))';
disp(' information are reshaped for convert symbolic form');
disp(msg_reshape);
fprintf('\n\n');

size(msg_reshape);
for(j=1:1:nbit/log2(M))
for(i=1:1:log2(M))
a(j,i)=num2str(msg_reshape(j,i));
end
end

as=bin2dec(a);
ass=as';
figure(1)
subplot(3,1,2);
stem(ass,'Linewidth',2.0);
title('serial symbol for 4-array QAM modulation at transmitter');
xlabel('n(discrete time)');
ylabel(' magnitude');

disp('symbolic form information for 4-array QAM ');


disp(ass);
fprintf('\n\n');

%XXXXXXXXXXXXXX Mapping for 4-array QAM modulation XXXXXXXXXXXXXXXXXXXXXXXX


M=M; %order of QAM modulation
x1=[0:M-1];
p=qammod(ass,M) %constalation design for M-array QAM acording to symbol
sym=0:1:M-1; % considerable symbol of M-array QAM, just for scatterplot
pp=qammod(sym,M); %constalation diagram for M-array QAM
scatterplot(pp),grid on;
title('constellation diagram for 4-array QAM');

%XXXXXXXXXXXXXXXXXXXXXX 4-array QAM modulation XXXXXXXXXXXXXXXXXXXXXXXXXXX


RR=real(p)
II=imag(p)
sp=bp*2; %symbol period for 4-array QAM
sr=1/sp; % symbol rate
8
f=sr*2;
t=sp/100:sp/100:sp;
ss=length(t);
m=[];
for(k=1:1:length(RR))
yr=RR(k)*cos(2*pi*f*t); % inphase or real component
yim=II(k)*sin(2*pi*f*t); % Quadrature or imagenary component
y=yr+yim;
m=[m y];
end
tt=sp/100:sp/100:sp*length(RR);
figure(1);
subplot(3,1,3);
plot(tt,m);
title('waveform for 4-array QAM modulation acording to symbolic information');
xlabel('time(sec)');
ylabel('amplitude(volt)');

%XXXXXXXXXXXXXXXXXXXX 4-array QAM demodulation XXXXXXXXXXXXXXXXXXXXXXXXXXXX


m1=[];
m2=[];
for n=ss:ss:length(m)
t=sp/100:sp/100:sp;
y1=cos(2*pi*f*t); % inphase component
y2=sin(2*pi*f*t); % quadrature component
mm1=y1.*m((n-(ss-1)):n);
mm2=y2.*m((n-(ss-1)):n);
z1=trapz(t,mm1) % integration
z2=trapz(t,mm2) % integration
zz1=round(2*z1/sp)
zz2=round(2*z2/sp)
m1=[m1 zz1]
m2=[m2 zz2]
end

%XXXXXXXXXXXXXXXXXXX de-mapping for 4-array QAM modulation XXXXXXXXXXXXXXXX


clear i;
clear j;
for (k=1:1:length(m1))
gt(k)=m1(k)+j*m2(k);
end
gt

ax=qamdemod(gt,M);
figure(3);
subplot(2,1,1);
stem(ax,'linewidth',2);
title(' re-obtain symbol after 4-array QAM demodulation ');
xlabel('n(discrete time)');
ylabel(' magnitude');

disp('re-obtain symbol after 4-array QAM demodulation ');


disp(ax);
fprintf('\n\n');

bi_in=dec2bin(ax);
[row col]=size(bi_in);
p=1;
for(i=1:1:row)
for(j=1:1:col)
re_bi_in(p)=str2num(bi_in(i,j));
p=p+1;
end
9
end
disp('re-obtain binary information after 4-array QAM demodulation');
disp(re_bi_in')
fprintf('\n\n');

%XX representation of receiving binary information as digital signal XXXXXX


x=re_bi_in;
bp=.000001; % bit period
bit=[];
for n=1:1:length(x)
if x(n)==1;
se=ones(1,100);
else x(n)==0;
se=zeros(1,100);
end
bit=[bit se];
end
t1=bp/100:bp/100:100*length(x)*(bp/100);
figure(3)
subplot(2,1,2);
plot(t1,bit,'lineWidth',2.5);grid on;
axis([ 0 bp*length(x) -.5 1.5]);
ylabel('amplitude(volt)');
xlabel(' time(sec)');
title('receiving information as digital signal after 4-array QAM
demoduation');
%>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> end of program <<<<<<<<<<<<<<<<<<<<<<<<<
2. Result

Figure 5.1 4-QAM modulation

10
Figure 5.2 4 level QAM Constellation

Figure 5.3 4-QAM Demodulation

VI. Bit error rate (BER)


1. BER theory
Bit error rate, BER is a key parameter that is used in assessing systems that
transmit digital data from one location to another. Systems, for which bit error rate-BER
is applicable, include radio data links as well as fibre optic data systems, Ethernet, or
11
any system that transmits data over a network of some form where noise, interference,
and phase jitter may cause degradation of the digital signal. Although there are some
differences in the way these systems work and the way in which bit error rate is affected,
the basics of bit error rate itself are still the same.
When data is transmitted over a data link, there is a possibility of errors being
introduced into the system. If errors are introduced into the data, then the integrity of
the system may be compromised. As a result, it is necessary to assess the performance
of the system, and bit error rate, BER, provides an ideal way in which this can be
achieved. Unlike many other forms of assessment, bit error rate, BER assesses the full
end to end performance of a system including the transmitter, receiver and the medium
between the two. In this way, bit error rate, BER enables the actual performance of a
system in operation to be tested, rather than testing the component parts and hoping that
they will operate satisfactorily when in place.
As the name implies, a bit error rate is defined as the rate at which errors occur
in a transmission system. This can be directly translated into the number of errors that
occur in a string of a stated number of bits. The definition of bit error rate can be
translated into a simple formula:

, =

Expressions for the symbol-error rate of rectangular QAM are not hard to
derive but yield rather unpleasant expressions. For an even number of bits per
symbol, , exact expressions are available. They are most easily expressed in a per
carrier sense:

1 3
= 2 (1 ) ( )
1 0

So
= 1 (1 )2

The bit-error rate depends on the bit to symbol mapping, but for 1 and a
0

Gray-coded assignmentso that we can assume each symbol error causes only one
bit error- the bit-error rate is approximately

12
4 1 3
= (1 ) ( )
1
1 0
2
Since the carriers are independent, the overall bit error rate is the same as the
per-carrier error rate, just like BPSK and QPSK.
=
An exact and general closed-form expression of the Bit Error Rates (BER) for
rectangular type of Quadrature Amplitude Modulation (QAM) over AWGN and slow,
flat, Rician fading channels were derived analytically. Consider a (LM)-QAM
system with 2. 2 levels and 2. 2 levels in the I-channel and Q-channel,
respectively and a two-dimensional grey code mapping employed. The generalized
expression for the conditional BER on SNR over AWGN channel is
2 2
1
(|) = ( ( |) + ( |))
(
2 . )
=1 =1

Where
(121 )1
.21
2 |

| 21 1 6
( |) = (1) 1
. (2 [ + ]) [(2 + 1) 2 ]
2 ( + 2 2)
=0

2. BER simulation using Matlab and comparing with theory


Matlab code
% Step 1. Generate message signal of length >= M^L.
M = 64; % Alphabet size of modulation
L = 1; % Length of impulse response of channel
msg = [0:M-1 0]; % M-ary message sequence of length > M^L

% Step 2. Modulate the message signal using baseband modulation.


hMod = comm.RectangularQAMModulator(M); % Use 4-QAM.
modsig = step(hMod,msg'); % Modulate data
Nsamp = 4;
modsig = rectpulse(modsig,Nsamp); % Use rectangular pulse shaping.

% Step 3. Apply a transmit filter.


txsig = modsig; % No filter in this example

% Step 4. Run txsig through a noiseless channel.

13
rxsig = txsig*exp(1i*pi/180); % Static phase offset of 1 degree
% Step 5. Use the semianalytic function.
% Specify the receive filter as a pair of input arguments.
% In this case, num and den describe an ideal integrator.
num = ones(Nsamp,1)/Nsamp;
den = 1;
EbNo = 0:20; % Range of Eb/No values under study
ber = semianalytic(txsig,rxsig,'qam',M,Nsamp,num,den,EbNo);

% For comparison, calculate theoretical BER.


bertheory = berawgn(EbNo,'qam',M);

% Plot computed BER and theoretical BER.


figure; semilogy(EbNo,ber,'k*');
hold on; semilogy(EbNo,bertheory,'ro');
title('Semianalytic BER Compared with Theoretical BER');
legend('Semianalytic BER with Phase Offset',...
'Theoretical BER Without Phase Offset','Location','SouthWest');
hold off;

Result

Figure 6.1 BER of 4-QAM

14
From figure, we see that the simulation results and calculation theory are almost
same.

VII. Signal error rate


1. SER theory.

The scaling factor of is for normalizing the average energy of the transmitted
2

symbols to 1, assuming that all the constellation points are equally likely.


(1 + ) (1 + )
2 2


(1 ) (1 )
2 2

Assuming that the additive noise follows the Gaussian probability distribution
function,

()2
1 0
() = 22 2 with = 0 and 2 =
2

Consider the symbol of 2 , the conditional probability distribution function (PDF)


of y given 2 was transmitted is:

2
( )
1 2
(|2 ) = 0
0

15
Figure 7.1 Probability density function for 4QAM modulation

As can be seen from the above figure, the symbol 2 is decoded correctly only if y
falls in the area in the hashed region i.e.

( |2 ) = (>0 |2 )(>0 |2 )

Probability of real component of y greater than 0, given 2 was transmitted is (i.e.


area outside the red region):

0
( )2
1 2 1
(>0 |2 ) = 1 0 = 1 ( )
0 2 20

2 2
Where the complementary error function, () =

Similarly, probability of imaginary component of y greater than 0, given 2 was


transmitted is (i.e. area outside the blue region).

0
( )2
1 2 1
(>0 |2 ) = 1 0 = 1 ( )
0 2 20

The probability of 2 being decoded correctly is,

2
1
( |2 ) = [1 ( )]
2 20

16
2 1
= [1 ( ) + 2 ( )]
2 2 4 0 2 0

1
= 1 ( ) + 2 ( )
20 4 20

Hence, the total symbol error probability: the symbol will be in error, it at least one of the
symbol is decoded incorrectly. The probability of symbol error is,
= 1 ( |2 )

1
= 1- [1 ( ) + 2 ( )]
20 4 20

1
= ( ) 2 ( )
20 4 20

2. SER simulation by using Matlab and comparing with theory


Matlab code
% symbol error rate for 4-QAM modulation

clear
N = 10^5; % number of symbols
Es_N0_dB = [-3:20]; % multiple Eb/N0 values
ipHat = zeros(1,N);
for ii = 1:length(Es_N0_dB)
ip = (2*(rand(1,N)>0.5)-1) + j*(2*(rand(1,N)>0.5)-1); %
s = (1/sqrt(2))*ip; % normalization of energy to 1
n = 1/sqrt(2)*[randn(1,N) + j*randn(1,N)]; % white guassian noise, 0dB
variance

y = s + 10^(-Es_N0_dB(ii)/20)*n; % additive white gaussian noise

% demodulation
y_re = real(y); % real
y_im = imag(y); % imaginary
ipHat(find(y_re < 0 & y_im < 0)) = -1 + -1*j;
ipHat(find(y_re >= 0 & y_im > 0)) = 1 + 1*j;
ipHat(find(y_re < 0 & y_im >= 0)) = -1 + 1*j;
ipHat(find(y_re >= 0 & y_im < 0)) = 1 - 1*j;

17
nErr(ii) = size(find([ip- ipHat]),2); % couting the number of errors
end

simSer_4QAM = nErr/N;
theorySer_4QAM = erfc(sqrt(0.5*(10.^(Es_N0_dB/10)))) -
(1/4)*(erfc(sqrt(0.5*(10.^(Es_N0_dB/10))))).^2;

close all
figure
semilogy(Es_N0_dB,theorySer_4QAM,'b.-');
hold on
semilogy(Es_N0_dB,simSer_4QAM,'mx-');
axis([-3 15 10^-5 1])
grid on
legend('theory-4QAM', 'simulation-4QAM');
xlabel('Es/No, dB')
ylabel('Symbol Error Rate')
title('Symbol error probability curve for 4-QAM')

Result

Figure 7.2 SER of 4-QAM


18
From figure, we see that the simulation results and calculation theory are almost
same.

VIII. CONCLUSION
This report has detailed our implementation of the complete Four Level
Quadrature Amplitude Modulation. We simulated 4-QAM modulation/demodulation
techniques by using Matlab. Also, Matlab is used to evaluate the performance of 4- QAM
technique through plotting the Bit Error Rate (BER) vs Signal Error Rate (SER). Our
results match the theoretical values exactly.

19
REFERENCES

Xiaolong Li, Simulink-based Simulation of Quadrature Amplitude Modulation


(QAM) System, Proceedings of the 2008 IAJC-IJME International Conference.
https://en.wikipedia.org/wiki/Quadrature_amplitude_modulation

20

Das könnte Ihnen auch gefallen