Hi,
I'm new member in this group. I'm trying to do MATLAB code for OFDM Tx
and Rx and measure and plot all the system parameters like BER, PAPR,
Synchronization, Channel Estimation and others. here is my first and starting
attempt. can any one help me to complete this program?
Regards.
Here is my initial program
clear all;
close all;
clc;
%=======================================================================% OFDM
Simulation - OFDM.m
% OFDM System Parameters
N = 64; % length of OFDM IFFT (16,32,64,...,2^n)
M = 16; % number of QAM constellation points (4,16,64,256)
numOfZeros = N/4+1; % numOfZeros must be an odd number and lower
% than N. The zero padding operation is
% necessarry in practical implementations.
GI = 1/4; % Guard Interval (1/4,1/8,1/16,...,4/N)
BW = 20; % OFDM signal Band width in MHz
numOfSym = 128; % number of OFDM Symbols
EbNo = 0:20;
% data generation randint
%
txData = randint(N-numOfZeros,numOfSym,M,0);
% QAM modulation
txDataMod = qammod(txData,M);
mean(abs(txDataMod(:,2)).^2);
txDataZpad = [txDataMod((N-numOfZeros+1)/2:end,:);...
zeros(numOfZeros,numOfSym);...
txDataMod(1:(N-numOfZeros-1)/2,:)];
%====================================================================== %
IFFT
txDataZpadIfft = sqrt(N)*ifft(txDataZpad,N);
%====================================================================== % Apply
windowing function to each time domain waveform
for i = 1:numOfSym
txDataZpadIfft1(:,i) = (txDataZpadIfft(:,i)).*hamming(N);
end
% Guard Interval Insertion
txDataZpadIfftGI = [txDataZpadIfft1((1-GI)*N+1:end,:);txDataZpadIfft];
%cp insertion
txDataZpadIfftGI1 = reshape(txDataZpadIfftGI,1,10240);
% Add Noise
Tx_Signal_Power = var(txDataZpadIfftGI1);
SNR = 20;
Linear_SNR = 10^(SNR/10);
Noise_Sigma = Tx_Signal_Power/Linear_SNR;
Noise_Scale_Factor = sqrt(Noise_Sigma);
Noise = randn(1,length(txDataZpadIfftGI1))*Noise_Scale_Factor;
Tx_NoisyData = txDataZpadIfftGI1+Noise;
% ========= receiver part ======================txDataZpadIfftGI11 =
reshape(Tx_NoisyData,80,128);
% Guard Interval removal
rxDataZpadIfft = txDataZpadIfftGI(GI*N+1 : N+GI*N,:);
%====================================================================== %
FFT operation
rxDataZpad = 1/sqrt(N)*fft(rxDataZpadIfft,N);
%====================================================================== %
zero removal and rearrangement
rxDataMod = [rxDataZpad((N-(N-numOfZeros-1)/2+1):N,:);...
rxDataZpad(1:(N-numOfZeros+1)/2,:)];
% demodulation
rxData =qamdemod(rxDataMod*sqrt(10),M);
%=========================================================================%=========================================================================