0% found this document useful (0 votes)
95 views6 pages

Adaptive Modulation & Coding: All All

This MATLAB code implements adaptive modulation and coding (AMC) for digital communication over an AWGN channel. It generates random input bits and SNR values, then modulates the bits using different modulation schemes (BPSK, QPSK, 16-QAM, 64-QAM) depending on the SNR. The modulated signals are passed through an AWGN channel and demodulated. Bit error rate (BER) is calculated and plotted against SNR, showing how higher order modulations are used at higher SNRs to increase throughput. Throughput is also plotted versus SNR to demonstrate how AMC increases spectral efficiency by adapting the modulation.

Uploaded by

ABINAYA
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
95 views6 pages

Adaptive Modulation & Coding: All All

This MATLAB code implements adaptive modulation and coding (AMC) for digital communication over an AWGN channel. It generates random input bits and SNR values, then modulates the bits using different modulation schemes (BPSK, QPSK, 16-QAM, 64-QAM) depending on the SNR. The modulated signals are passed through an AWGN channel and demodulated. Bit error rate (BER) is calculated and plotted against SNR, showing how higher order modulations are used at higher SNRs to increase throughput. Throughput is also plotted versus SNR to demonstrate how AMC increases spectral efficiency by adapting the modulation.

Uploaded by

ABINAYA
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Abinaya.

s
2016105003

ADAPTIVE MODULATION & CODING


Code:

clc;
clear all;
close all;
in=randi([0,1],1,24)
len=length(in);
out=[];
mod2=[];
mod4=[];
mod16=[];
mod64=[];
Snr=randi([5,30],1,5)
for i=1:5
if(Snr(i)<=7)
%BPSK Modulation
mod2(i,:)=pskmod(in,2);
y1=awgn(mod2(i,:),Snr(i),'measured');
out(i,:)=pskdemod(y1,2);
elseif(Snr(i)<=13)
%QPSK Modulation
x1=reshape(in,2,len/2)';
x2=num2str(x1);
x3=bin2dec(x2);
mod4(i,:)=pskmod(x3,4);
y2=awgn(mod4(i,:),Snr(i),'measured');
z=pskdemod(y2,4);
z1=dec2bin(z,2);
z2=rem(z1,2);
out(i,:)=reshape(z2',1,len);
elseif(Snr(i)<=21)
%16 QAM
a1=reshape(in,4,len/4)';
a2=num2str(a1);
a3=bin2dec(a2);
1
mod16(i,:)=pskmod(a3,16);
y2=awgn(mod16(i,:),Snr(i),'measured');
l=pskdemod(y2,16);
l1=dec2bin(l,4);
l2=rem(l1,2);
out(i,:)=reshape(l2',1,len);
elseif(Snr(i)>=22&&Snr(i)<=30)
%64 QAM
m1=reshape(in,6,len/6)';
m2=num2str(m1);
m3=bin2dec(m2);
mod64(i,:)=pskmod(m3,64);
y3=awgn(mod64(i,:),Snr(i),'measured');
n=pskdemod(y3,64);
n1=dec2bin(n,6);
n2=rem(n1,2)
out(i,:)=reshape(n2',1,len);
end

end
out
[num,ratio]=biterr(out,in);
for i=1:5
if(ratio(i)==0)
ratio(i)=1e-7;
end
end
Ber=ratio
%Throughput
th=[];
th(1:7)=1;
th(8:13)=2;
th(14:21)=4;
th(22:30)=6;
semilogy(Snr,ratio);
title('Snr vs Ber');
xlabel('Snr (dB)');
ylabel('Ber ');
figure;
plot(1:30,th)

2
title('SNR vs Throughput');
xlabel('Snr (dB)');
ylabel('Throughput ');

Output:

in =

Columns 1 through 15

0 0 1 1 1 1 0 0 1 0 1 1 0 1 0

Columns 16 through 24

0 0 1 1 1 1 1 1 0

Snr =

24 22 12 13 28

n2 =

0 1 0 0 0 0
0 0 1 0 1 1
0 1 0 0 0 1
1 1 1 1 1 0

n2 =

0 0 1 1 1 0
0 0 1 0 1 1
0 1 0 0 0 1
1 1 1 1 1 0

n2 =

0 0 1 1 1 1
0 0 1 0 1 1
0 1 0 0 0 1
1 1 1 1 1 0

3
out =

Columns 1 through 15

0 1 0 0 0 0 0 0 1 0 1 1 0 1 0
0 0 1 1 1 0 0 0 1 0 1 1 0 1 0
0 0 1 1 1 1 0 0 1 0 1 1 0 1 0
0 0 1 1 1 1 0 0 1 0 1 1 0 1 0
0 0 1 1 1 1 0 0 1 0 1 1 0 1 0

Columns 16 through 24

0 0 1 1 1 1 1 1 0
0 0 1 1 1 1 1 1 0
0 0 1 1 1 1 1 1 0
0 0 1 1 1 1 1 1 0
0 0 1 1 1 1 1 1 0

Ber =

0.2083
0.0417
0.0000
0.0000
0.0000

4
5
6

You might also like