ADAPTIVE MODULATION OFDM LTE GENERAL CODE
clc;
clear all;
close all;
%assigning the variables
N = 1536;
bw = 15*10^6;
T = 1/bw;
SNR = 10:1:30;
BER_tar = 10^(-3);
% finding the target snr
M=[2 4 16 64];
for i=1:length(M)
if M(i)==2
SNR_tar(i)=((M(i)-1)*log(.5*10^(-3)))/(-1.5);
else
SNR_tar(i)=((M(i)-1)*log(5*10^(-3)))/(-1.5);
end
end
%Indoor delay
in_delay = [0 50 110 170 290 310];
N_tap = ceil(max(in_delay)*(10^(-9))/T);
c_in = zeros(1,N_tap+1);
c_tap = ceil(in_delay./50)+1;
inPwr_dB = [0 -3 -10 -18 -26 -32];%% power in dB
inPwr = 10.^(inPwr_dB/10);%% converting to linear scale
c_r = abs(((inPwr/2).*randn(1,length(inPwr)))+((inPwr/2).*randn(1,length(inPwr)))*1i);
for k=1:length(c_tap)
c_in(c_tap(k))=c_r(k);
end
hf = fft(c_in,1536);
for s=1:length(SNR)
recSNR = abs(hf.*SNR(s));
for i=1:length(recSNR)
if recSNR(i) < SNR_tar(1)
b(i) = 1;
elseif ((recSNR(i) > SNR_tar(1))&&(recSNR(i) < SNR_tar(2)))
b(i) = 2;
elseif ((recSNR(i) > SNR_tar(2))&&(recSNR(i) < SNR_tar(3)))
b(i) = 4;
else
b(i) = 8;
end
end
spec_indoor(s) = mean(b);
end
% Finding the multipath channel response
out_delay = [0 10 90 135 230 275 310 420 630 635 745 815 830 1430 1790 2075];
N_tap = ceil(max(out_delay)*(10^(-9))/T);
c_out = zeros(1,N_tap+1);
c_tap = ceil(out_delay./50)+1;
outPwr_dB = [-2.6 -8.5 -14.8 -17.5 -19.2 -18.8 -14.9 -14.9 -22.1 -10.3 -22.2 -19.2 -16 -22.9 -20.3 -27.4];
outPwr = 10.^(outPwr_dB/10);
c_r = abs(((outPwr/2).*randn(1,length(outPwr)))+((outPwr/2).*randn(1,length(outPwr)))*1i);
for k=1:length(c_tap)
c_out(c_tap(k))=c_r(k);
end
hf = fft(c_out,1536);
for s=1:length(SNR)
recSNR = abs(hf.*SNR(s));
for i=1:length(recSNR)
if recSNR(i) < SNR_tar(1)
b(i) = 1;
elseif ((recSNR(i) > SNR_tar(1))&&(recSNR(i) < SNR_tar(2)))
b(i) = 2;
elseif ((recSNR(i) > SNR_tar(2))&&(recSNR(i) < SNR_tar(3)))
b(i) = 4;
else
b(i) = 8;
end
end
spec_outdoor(s) = mean(b);
end
plot(SNR, spec_indoor,'r');
hold on;
plot(SNR, spec_outdoor,'b');
grid on;
title('Adaptive Modulation');
xlabel('SNR (db)');
ylabel('Spectral efficiency in bits/Hz');
legend('Indoor','Outdoor');
Cite As
raghav khandelwal (2024). ADAPTIVE MODULATION OFDM LTE GENERAL CODE (https://www.mathworks.com/matlabcentral/fileexchange/50847-adaptive-modulation-ofdm-lte-general-code), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
Version | Published | Release Notes | |
---|---|---|---|
1.0.0.0 | code for adaptive modulation |