You are on page 1of 14

HIGHER COLLEGES OF TECHNOLOGY

ABUDHABI WOMEN’S COLLEGE

Department of Electrical Engineering Technology

Laboratory report

ELE 4233 Mobile Communication

Lab 07
Investigation of M-QAM performance in Gaussian
and fading channels.

Student name: Shouq Aljawhari

Student ID: H00366552

Date: 7th November 2020

0
Þ Objective
o To study and understand QAM and M-QAM

o To study the bit error rate in 16QAM in Gaussian channel.

o To understand Matlab Simulation of M-QAM Gaussian channel

Þ Equipment & Software Needed


o Matlab Simulation Software

o Matlab Communication Toolbox”

Þ Introduction & Theory

Amplitude modulation (AM) is a modulation technique used in electronic

communication, most commonly for transmitting messages with a radiocarrier wave.

In amplitude modulation, the amplitude (signal strength) of the carrier wave is varied

in proportion to that of the message signal, such as an audio signal. This technique

contrasts with angle modulation, in which either the frequency of the carrier wave is

varied as in frequency modulation, or its phase, as in phase modulation.

However, quadrature amplitude modulation, otherwise known as QAM, contain both

the amplitude and phase modulation in order to achieve a further greater capacity.

This method is used a lot in data communication. Furthermore, QAM is a signal

where 2 carriers are modulated and combined. Those carriers should have gone

through a phase shift of 90 degrees beforehand. An example are sine and cosine.

1
Moreover, the reason this 90-degree shift in phase is required is because it will cause

the carriers to become quadrature, hence the name. usually, one of the singles is

known as the in-phase signal or the “I” signal. This leaves the second signal to be

named as the quadrature or the “Q” signal.

Moreover, signals take on 2 statuses. Those statuses are responsible for the transfer of

either 0 or 1. In addition, when using the quadrature amplitude modulation,

constellation diagram can occur. Constellation diagram is the selection of a various of

points of different phase and amplitude values. Using this, each signal will transfer

data at a high speed because each different position has a different value.

2
Þ Procedures
o Open the Matlab simulation software.

o Write required commands/code in Command Window.

o Execute commands/code.

o Find results and plots in simulation Window.

o Compare and analyze practical output with theoretical output.

Þ Simulation Results (Codes & Figures)

o Code 1: QAM Signal Generation, Modulation &


Demodulation
%>>>>>>>>>>>>>>>>>> Matlab code for M 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');

3
%XX representation of transmitting binary information as digital signal XXX
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 M-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 M-array QAM modulation at transmitter');
xlabel('n(discrete time)');
ylabel(' magnitude');
disp('symbolic form information for M-array QAM ');
disp(ass);
fprintf('\n\n');
%XXXXXXXXXXXXXX Mapping for M-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('consttelation diagram for M-array QAM');
%XXXXXXXXXXXXXXXXXXXXXX M-array QAM modulation
XXXXXXXXXXXXXXXXXXXXXXXXXXX
RR=real(p)
II=imag(p)
4
sp=bp*2; %symbol period for M-array QAM
sr=1/sp; % symbol rate
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 M-array QAM modulation acording to symbolic information');
xlabel('time(sec)');
ylabel('amplitude(volt)');
%XXXXXXXXXXXXXXXXXXXX M-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 M-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 M-array QAM demodulation ');
xlabel('n(discrete time)');
ylabel(' magnitude');
disp('re-obtain symbol after M-array QAM demodulation ');
disp(ax);
fprintf('\n\n');
bi_in=dec2bin(ax);
[row col]=size(bi_in);
5
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
end
disp('re-obtain binary information after M-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 M-array QAM demoduation');

6
o Results 1:

1. Value Of M Array For QAM Modulation: 4

Figure 1.1: Value of M array for QAM modulation is 4

Figure 1.2: Value of M array for QAM modulation is 4

7
Figure 1.3: Value of M array for QAM modulation is 4
2. Value Of M Array For QAM Modulation: 16

Figure 2.1: Value of M array for QAM modulation is 16

Figure 2.2: Value of M array for QAM modulation is 16

Figure 2.3: Value of M array for QAM modulation is 16


o Code 2: Simulation M-QAM performance in noise
channel using matlab
clc;
clear all;
close all;
q=4; %
M=2^q; % M-QAM level power of 2
loop=10; % Monte Carlo
N=100000; % Frame length (x_1 x_2 ... x_N)
SNRdB=0:15; % SNR in dB
SNR=10.^(SNRdB/10);
Rate= zeros(1, length(SNRdB)); %
% ********************* Transmitter **************************************%
for dB= 1: length(SNRdB) % start looping by SNR
dB
for lp= 1: loop, % start looping of frame data
% ********************* q-QAM signal generation **************************%
x_inp=round(rand(N,1)); % 1 or 0
x_inp_mod=qammod(x_inp,q);
% ********************* Channel ******************************************%
y_channel=awgn(x_inp_mod,SNRdB(dB)); % AWGN

% ********************* Receiver *****************************************%


y=y_channel;
x_inp_dem=qamdemod(y,q);
x_out=round(x_inp_dem);

% ********************* Bit Error Rate (BER) calulation ******************%

[err, rate]= symerr(x_inp, x_out);


Rate(dB)= Rate(dB) + rate;

end % end for loop

Rate(dB)= Rate(dB)/loop; % Average value over Monte Carlo simulation


% loop

end % end Monte Carlo


% ********************* Plot the simulation result ***********************%
f1 = figure(1);
set(f1,'color',[1 1 1]);
semilogy(SNRdB,Rate, 'b-*')
hold on;
BER_th= (2*(sqrt(M)-1)/sqrt(M))*qfunc(sqrt((6*q/(M-1)))*sqrt(SNR)); %
theoritical calculation for BER
semilogy(SNRdB,BER_th,'r-o');
hold on;
axis([0 12 0.00000001 1.2]);
xlabel( 'Signal-to-Noise Ratio (SNR)')
ylabel( 'Bit Error Rate (BER)')
title('Simulation QAM transmission over noise');
legend('BER simulation','BER calculation')
grid on;

9
o Results 2:


igure 3: Simulation QAM transmission over noise
F

10
Þ Observation/Findings
o The main observation I achieved was with the second code that took interest
in the simulation of M-QAM performance in the noise channel. When
generated in the Matlab software, this code produced the graph shown in
figure 3. This graph describes a declining line showing that the less the bit
error rate, BER, the greater is the signal to noise ratio, SNR. In this graph the
red line represents the BER calculations while the blue line represents the
BER simulation. Meaning that my finding based on this was the SNR and
BER have an inversely proportional relationship. Moreover, I have found that
bit error rate calculation was higher than its simulation throughout the
transmission over noise.

Þ Discussion/Analysis

o One of important goals for this lab is to study the quadrature amplitude
modulation. This was done by applying a Matlab code regarding the QAM
signal generation, modulation, and demodulation. This program considered the
M array for a QAM modulation and m will ask the user to enter the value for it,
and in our case the needed values are 4 and 16. I started with the 4 M array
value, which produced an output describing various elements. The first element
was the amplitude in volt/ time in seconds graph which represented the
information transmission as a digital signal, (Figure 1.1). moreover, another
element shown in the same figure is the serial symbol for M-array QAM
modulation at the transmitter which is represented by a discrete sequence graph/
stem graph, which have an X-axis regarding the discrete time, n, while the
magnitude is on the Y-axis. The final element on the same figure is the
waveform for the M-array QAM. This waveform is with consideration to the
symbolic information. It is represented in a subplot. In here as well we find the
time on the X-axis while the amplitude on the Y-axis. Another output of this
code is shown in figure 1.2, which discuss two elements. The first regarding the
re-obtained symbol after M-array QAM demodulation and the second regarding
the receiving information as digital signal after M-array QAM demodulation.
And the last output produced was the constellation diagram for M-array QAM
having the in-phase as the X-axis while the quadrature as the Y-axis.

o All three output were valid as well when entering the value for that M array
for a QAM modulation as 16. However, there was an obvious change in the
results. For example, the first change observed was in the first output. It is
shown that in the same time period, the voltage has reached the peak, at the
transmission of information as a digital signal, much more several times when
the M array value was 4 rather than 16. Additionally, the same goes for the serial
symbol, where it has reached a less magnitude throughout the same time at 16
M array. And finally, the waveform is shown to be less noisy at 16 M array than
it is on 4 M array. Furthermore, same goes for the second output of “re-obtain

11
symbol after M-array QAM demodulation” and “receiving information as
digital signal after M-array QAM demodulation”, where the less value of 4 M
array for QAM modulation is shown to be the busiest. For instance, in 16 M
array, we see an active magnitude on the first graph at only four points
throughout the same time duration, while on 4 M array, the active points are
shown all throughout the time duration. And lastly for the final output
considering the constellation diagram for the M-array QAM, we can see the big
difference of having only4 points on the 4 M array while having 16 on the 16
M array. This is due to each specific value.

o Secondly, I applied a second code that took interest in the simulation of M-


QAM performance in the noise channel. When generated in the Matlab
software, this code produced the graph shown in figure 3. This graph describes
a declining line showing that the less the bit error rate, BER, the greater is the
signal to noise ratio, SNR. In this graph the red line represents the BER
calculations while the blue line represents the BER simulation.

Þ Conclusion
o Overall, I accomplished the goals of this lab to study and understand the
concept of the QAM and M-QAM and generate outputs of its Matlab code
which regarded the QAM signal generation, modulation, and demodulation.
Also, I was able to learn about bit error rate in 16QAM in Gaussian channel
But more importantly, during that I was able to come to the conclusion that
explained the relationship between the BER and SNR in the simulation of M-
QAM performance in the noise channel. I have learned that this relationship is
inversely proportional, meaning the more is the BER, the less is the SNR. And
lastly, I was able to reflect and analyze all of that using the MATLAB
simulation of M-QAM Gaussian channel.

Þ References
o https://en.wikipedia.org/wiki/Amplitude_modulation

12
Grading Rubric
SL No Rubrics Mark Code
1 Individual Assessment 30 (10 +10+10) A
2 Troubleshooting and problem solving/ post lab test 10 B
3 Introduction/ Objective/ Procedure 5 C
4 Calculations /Codes/ Theory. 5 D
5 Data collection/ Findings / observations 5 E
6 Diagrams / Charts / Figures and Plots with Captions 10 F
7 Analysis & Discussion / (theory vs actual) 15 G
8 Conclusions/ Summary /self-reflection 15 H
Quality of work performed including quality of lab
9 5 I
report, neatness etc.

13

You might also like