Assignmeant Two Group
Assignmeant Two Group
Group member
1. Abel Teshome
2. Assefa mesele
3. Yimer mekonne submitted to: Alemu jorrgi (ph.D)
Contents
Question 1...................................................................................................................................................1
Answer........................................................................................................................................................1
Theoretical and simulation (QPSK and QAM-4) over AWGN and Rayleigh fading channel..................3
Question 2...................................................................................................................................................5
2. MATLAB code for BER analysis of QAM-16 over AWGN and Rayleigh channel............................8
Figure 1 Theoretical BER performance as a function of Eb /No (dB) over AWGN and Rayleigh channel.....2
Figure 2 compare BER performance on both AWGN and Rayleigh fading channel...................................2
Figure 3 compare encoded QPSK and QAM-4 with un-coded....................................................................3
Figure 4 Compare Simulated Vs theoretical of QPSK and QAM plot.........................................................4
Figure 5 Compare BER performance as function of Eb/No for m-ary digital modulation type..................4
Question 1
1. Compare the BER performance of QPSK and QAM-4 as a function of Eb/NO or SNR dB over
AWGN and fading channel and compare them with theoretical BER.
The performance metrics or the important metric that you have to focus on in the digital communication
system, tare two.
Bit Error Rate (BER):- BER is a performance measurement that specifies the number of bit
corrupted or destroyed as they are transmitted from its source to its destination. Several factors
that affect BER include bandwidth, SNR, transmission speed and transmission medium.
number of bit with error
BER=
total no of bit sent
Signal to noise ratio (SNR):- defined as the ratio of a signal power to noise power and it is
normally expressed in decibel (dB).
signal power signal power P
For continuous signal= SNR= = =
noise power power density∗BW NoW
¿ = Es
For discrete time (digital) signal =energy ¿ transmit symbol
noise δ 2
The system is subjected to Additive White Gaussian Noise (AWGN) and multipath Rayleigh fading are
considered in the channel. There are many fading effects that can be categorized as large-scale and
small-scale fading. Rayleigh fading represents the worst case of multipath fading where it represents
small-scale fading due to small changes in position with respect to time that is Doppler Effect. On the
other hand, AWGN represents the thermal noise generated by electrical instruments. I.e. resistors, wires
and so on.
QPSK: - is one example of M-ray PSK modulation technique (M = 4) where it transmits 2 bits
per symbol.
QAM: - is a modulation technique where its amplitude is allowed to very with phase. QAM
signaling can be viewed as a combination of Amplitude Shift Keying (ASK) as well as Phase
Shift Keying (PSK).
Answer
The question has been answered by using MATLAB 7.5.0 for simulation and evaluation of Bit Error Rate
(BER) and Signal-To-Noise Ratio (SNR)
Figure 1 Theoretical BER performance as a function of Eb /No (dB) over AWGN and Rayleigh channel.
Figure 1 shows that theoretical BER performance of QPSK and QAM-4. The BER has been plotted as a
function of Eb/No for different (AWGN and Rayleigh fading channel.) For AWGN channel it is observed
that bit error rate (BER) performance gets degraded (decreased) compare to Rayleigh channel, because
Rayleigh fading channel is one part of multipath fading in small scale fading and useful model of real-
world.
Figure 2 compare BER performance on both AWGN and Rayleigh fading channel.
Figure 2 shows that when the Eb/No value goes to 10dB the BER performance over AWGN channel are
decreased to the value of (0.0000019953) but for Rayleigh fading channel BER are increased (0.050118)
for both QPSK and QAM-4. From this result we conclude that BER of AWGN channel are (0.0501)
better bit error rate than Rayleigh fading channel but in practice it’s not impossible for AWGN.
To address the above problem it uses coding on the channel for example for QPSK use encoded channel
and compare with QPSK un-coded it safes 6 dB transmitted power with the same BER performance.
Theoretical and simulation (QPSK and QAM-4) over AWGN and Rayleigh fading channel
As shown from the below figure 4 we observe and compare the simulated, theoretical part of QPSK and
QAM-4 by using bit error rate analysis tool on MATLAB software.
The result show that bit error rate (BER) when E b/No is 4dB the simulation result of QPSK is (0.02423),
but for theoretical result (0.0125). We observe that the simulation result is much higher BER than
theoretical over AWGN and Rayleigh fading channel.
It is observed that, the value of M bits ,the number of bits in a symbol increases ex- from 4 to 16, the error
rate also increases in both M-PSK and M-QAM but when we go to 64-QAm is better BER performance
than 32-PSK.
Question 2
BER analysis of QAM-16 modulation under AWGN channel.
1. MATLAB Code for BER analysis of digital modulation
clc;
close all;
EbN0dB=-4:1:24;
EbN0lin=10.^(EbN0dB/10);
colors={'k-*','g-o','r-h','c-s','m-s','y-*','k-p','b:s','m:d','g:p'};
index=1;
%BPSK
BPSK = 0.5*erfc(sqrt(EbN0lin));
plotHandle=plot(EbN0dB,log10(BPSK),char(colors(index)));
set(plotHandle,'LineWidth',1.5);
hold on;
index=index+1;
%M-PSK
m=2:1:5;
M=2.^m;
for i=M,
k=log2(i);
berErr = 1/k*erfc(sqrt(EbN0lin*k)*sin(pi/i));
plotHandle=plot(EbN0dB,log10(berErr),char(colors(index)));
set(plotHandle,'LineWidth',1.5);
index=index+1;
end
%Binary DPSK
Pb = 0.5*exp(-EbN0lin);
plotHandle = plot(EbN0dB,log10(Pb),char(colors(index)));
set(plotHandle,'LineWidth',1.5);
index=index+1;
%Differential QPSK
a=sqrt(2*EbN0lin*(1-sqrt(1/2)));
b=sqrt(2*EbN0lin*(1+sqrt(1/2)));
Pb = marcumq(a,b)-1/2.*besseli(0,a.*b).*exp(-1/2*(a.^2+b.^2));
plotHandle = plot(EbN0dB,log10(Pb),char(colors(index)));
set(plotHandle,'LineWidth',1.5);
index=index+1;
%M-QAM
m=2:2:6;
M=2.^m;
for i=M,
k=log2(i);
berErr = 2/k*(1-1/sqrt(i))*erfc(sqrt(3*EbN0lin*k/(2*(i-1))));
plotHandle=plot(EbN0dB,log10(berErr),char(colors(index)));
set(plotHandle,'LineWidth',1.5);
index=index+1;
end
legend('BPSK','QPSK','8-PSK','16-PSK','32-PSK','D-BPSK','D-QPSK','4-QAM','16-
QAM','64-QAM');
axis([-4 24 -8 0]);
set(gca,'XTick',-4:1:24);
ylabel('Probability of BER Error - log10(Pb)');
xlabel('Eb/N0 (dB)');
title('Probability of BER Error log10(Pb) Vs Eb/N0');
grid on;
2. MATLAB code for BER analysis of QAM-16 over AWGN and Rayleigh
channel.
% BER performance for 16-QAM Modualtion in Rayleigh and AWGN fading Channel
clear all;
close all;
% Frame Length 'Should be multiple of four or else padding is needed'
bit_count = 1*1000;
% Range of SNR over which to simulate
Eb_No = 0: 1: 10;
% Convert Eb/No values to channel SNR
SNR = Eb_No + 10*log10(4);
% Start the main calculation loop
for aa = 1: 1: length(SNR)
% Initiate variables
T_Errors = 0;
T_bits = 0;
% Keep going until you get 100 errors
while T_Errors < 100
% Generate some random bits
uncoded_bits = round(rand(1,bit_count));
% Split the stream into 4 substreams
B = reshape(uncoded_bits,4,length(uncoded_bits)/4);
B1 = B(1,:);
B2 = B(2,:);
B3 = B(3,:);
B4 = B(4,:);
% 16-QAM modulator
% normalizing factor
a = sqrt(1/10);
% bit mapping
tx = a*(-2*(B3-0.5).*(3-2*B4)-j*2*(B1-0.5).*(3-2*B2));
% Variance = 0.5 - Tracks theoritical PDF closely
ray =sqrt((1/2)*((randn(1,length(tx))).^2+(randn(1,length(tx))).^2));
% Include The Fading
rx = tx.*ray;
% Noise variance
N0 = 1/10^(SNR(aa)/10);
% Send over Gaussian Link to the receiver
rx = rx + sqrt(N0/2)*(randn(1,length(tx))+1i*randn(1,length(tx)));
% Equaliser
rx = rx./ray;
% 16-QAM demodulator at the Receiver
a = 1/sqrt(10);
B5 = imag(rx)<0;
B6 = (imag(rx)<2*a) & (imag(rx)>-2*a);
B7 = real(rx)<0;
B8 = (real(rx)<2*a) & (real(rx)>-2*a);
% Merge into single stream again
temp = [B5;B6;B7;B8];
B_hat = reshape(temp,1,4*length(temp));
% Calculate Bit Errors
diff = uncoded_bits - B_hat ;
T_Errors = T_Errors + sum(abs(diff));
T_bits = T_bits + length(uncoded_bits);
end
% Calculate Bit Error Rate
BER(aa) = T_Errors / T_bits;
disp(sprintf('bit error probability = %f',BER(aa)));
end
% Finally plot the BER Vs. SNR(dB) Curve on logarithmic scale
% BER through Simulation
figure(1);
semilogy(Eb_No,BER,'xr-','Linewidth',2);
hold on;
xlabel('E_b / N_o (dB)');
ylabel('BER');
title('E_b / N_o Vs BER plot for 16-QAM Modualtion in AWGN Rayleigh Channel');
% Theoretical BER
figure(1);
theoryBerAWGN = 0.5.*erfc(sqrt((10.^(Eb_No/10))));
semilogy(Eb_No,theoryBerAWGN,'g-+','Linewidth',2);
grid on;
legend('Rayleigh', 'AWGN');
axis([Eb_No(1,1) Eb_No(end) 0.00001 1]);