OFDM MULTIPATH CODE FOR OUTDOOR LTE GENERAL

OFDM MULTIPATH CODE FOR OUTDOOR LTE
436 Downloads
Updated 14 May 2015

View License

clc;
clear all;
close all;
% Initializing parameters
Nfft=input('Size of fft N = ');
Nused=input('Number of OFDM symbols to be used m = ');
M=input('Size of constellation M = ');
Type=input('Type of Mapping (1 for PSK) and (2 for QAM) = ');
Phase_Offset=input('phase offset = ');
Ncp=input('cyclic prefix samples Ncp = ');
bw = 15*10^6;%%bandwidth
T = 1/bw;%time period
% Transmitter

if Type == 1
Tx = modem.pskmod('M',M,'PhaseOffset',Phase_Offset,'SymbolOrder','gray');
Rx = modem.pskdemod('M',M,'PhaseOffset',Phase_Offset,'SymbolOrder','gray');
else
Tx = modem.qammod('M',M,'PhaseOffset',Phase_Offset,'SymbolOrder','gray');
Rx = modem.qamdemod('M',M,'PhaseOffset',Phase_Offset,'SymbolOrder','gray');
end

% Finding the multipath channel response
out_delay = [0 10 90 135 230 275 310 420 630 635 745 815 830 1430 1790 20];
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

% c_in_s=sum(c_in);

% data generation
Tx_data=randi([0 M-1],Nused,Nfft/2);
% Mapping
mod_data=modulate(Tx,Tx_data);
% Serial to Parallel
s2p=mod_data.';
% insertion of pilots (upsmapling)

upsampled=upsample(s2p,2);

% Amplitude modulation (IDFT using fast version IFFT)

am=ifft(upsampled,Nfft);

% Parallel to serial

p2s=am.';

% Cyclic Prefixing

CP_part=p2s(:,Nfft-Ncp+1:Nfft); % this is the Cyclic Prefix part to be appended.
cp=[CP_part p2s];
% cp_v=reshape(cp,Nused,Nfft+Ncp);

%c_in_v=reshape(c_in,1,8);
conv_data=convn(cp ,c_out);
% Reciever
% Adding Noise using AWGN
SNRstart=3;
SNRincrement=2;
SNRend=11;
c=0;
r=zeros(size(SNRstart:SNRincrement:SNRend));
for snr=SNRstart:SNRincrement:SNRend
c=c+1;

noisy=awgn(conv_data,snr,'measured');
% Remove cyclic prefix part
cpr=noisy(:,Ncp+1:Nfft+Ncp); %remove the Cyclic prefix
% serial to parallel
parallel=cpr.';
% Amplitude demodulation (DFT using fast version FFT)
amdemod=fft(parallel,Nfft);
% Down-Sampling

downsampled=downsample(amdemod,2);
% Parallel to serial
rserial=downsampled.';
% demodulation
Umap=demodulate(Rx,rserial);
% Calculating the Symbol Error Rate
[n, r(c)]=symerr(Tx_data,Umap);

end
figure(1)
snr=SNRstart:SNRincrement:SNRend;
% Plotting SER vs SNR
semilogy(snr,r,'-ok');
grid;
title('OFDM Symbol Error Rate vs SNR');
ylabel('Symbol Error Rate');
xlabel('SNR [dB]');

Cite As

raghav khandelwal (2024). OFDM MULTIPATH CODE FOR OUTDOOR LTE GENERAL (https://www.mathworks.com/matlabcentral/fileexchange/50846-ofdm-multipath-code-for-outdoor-lte-general), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2009b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories
Find more on End-to-End Simulation in Help Center and MATLAB Answers

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
1.0.0.0

GENERAL CODE DISPLAY OFDM MULTIPATH