BER VS SNR OF OFDM LTE AWGN (TRANSMITER AND RECIEVER)
clc;
clear all;
close all;
% Initializing parameters
Nfft=input('fft size N = ');
Nused=input('Number of OFDM symbols used m = ');
M=input('constellation size M = ');
Type=input('Type of Mapping (1 for PSK) and (2 for QAM) = ');
Phase_Offset=input('phase offset = ');
Ncp=input('cyclic prefix samples Ncp = ');
% 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
% data generation
Tx_data=randi([0 M-1],Nused,Nfft);
% modulation
mod_data=modulate(Tx,Tx_data);
% Serial to Parallel
s2p=mod_data.';
% insertion of pilots (upsmapling)
upsampled=upsample(s2p,1);
% Amplitude modulation (IDFT using fast version IFFT)
am=ifft(upsampled,Nfft);
% Parallel to serial
p2s=am.';
% Cyclic Prefixing
CP_part=p2s(:,end-Ncp+1:end); % this is the Cyclic Prefix part to be appended.
cp=[CP_part p2s];
% 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(cp,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,1);
% Parallel to serial
rserial=downsampled.';
% demodulation
Umap=demodulate(Rx,rserial);
% Calculating the Symbol Error Rate
[n, r(c)]=symerr(Tx_data,Umap);
end
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]');
Citar como
raghav khandelwal (2024). BER VS SNR OF OFDM LTE AWGN (TRANSMITER AND RECIEVER) (https://www.mathworks.com/matlabcentral/fileexchange/50844-ber-vs-snr-of-ofdm-lte-awgn-transmiter-and-reciever), MATLAB Central File Exchange. Recuperado .
Compatibilidad con la versión de MATLAB
Compatibilidad con las plataformas
Windows macOS LinuxCategorías
Etiquetas
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Descubra Live Editor
Cree scripts con código, salida y texto formateado en un documento ejecutable.
Versión | Publicado | Notas de la versión | |
---|---|---|---|
1.0.0.0 | GENERAL CODE |