MATLAB CODE:
clc;
clear all;
close all;
M=16; %for 16 QAM
k=log2(M); %defining no. of bits
n=10^5; %taking 100000 no. of bits
x = randi([0 1],n,4); %generation of random binary bits
Z = bi2de(x); %binary to decimal conversion
y = qammod(Z,M,0,’gray’); % QAM modulation
scatterplot(y);
N=length(y);
SNR=-3:20;
for i=1:length(SNR)
noise2=awgn(y,SNR(i)); %defining AWGN noise and adding with the qam modulated bits
Y2=qamdemod(noise2,M,0,’gray’); %QAM demodulation
ser2=step(comm.ErrorRate,Z,Y2); %defining SER
serVec2(i)=ser2(1);
end
semilogy(SNR,serVec2);
axis([-3 20 10^-5 1]);
grid on
xlabel(‘Eb/No (dB)’);
ylabel(‘BER’);
title(’16QAM Modulation in an AWGN channel’);
RESULT:
Leave a comment