i have written a code for BER v/s SNR calculation for AWGN channel with pilot insertion.why i m not getting feasible results

4 views (last 30 days)
M=2;
N=64;
Np=4;
Nframes=1000;
D = round((M-1)*rand((N-Np),Nframes));
data=D';
data=data(:);
Mod=pskmod(D,M); % PSK modulation
Mod=Mod';
pilot=3+3j; % pilot value
pilotdata=zeros(1000,64); % initializing with zeroes
u=0;
%pilot insertion
for p=1:1000
for q=1:13:52
pilotdata(p,q)=pilot;
J=q+1:q+12;
k=q-u:q-u+11;
pilotdata(p,J)=Mod(p,k);
u=u+1;
end
u=0;
end
for p=1:1000
m=53:64;
n=49:60;
pilotdata(p,m)=Mod(p,n);
end
% ofdm modulation
ifft_data=ifft(pilotdata',64)';
%cyclic prefix insertion
for p=1:1000
m=65:80;
n=1:16;
ifft_data1(p,m)= ifft_data(p,n);
end
% channel
for snr=100
ofdm_sig=awgn(ifft_data1,snr,'measured'); % Adding white Gaussian Noise
end
% receiver
% removing cyclic extension
for p=1:1000
i=1:64;
rxed_sig(p,i)=ofdm_sig(p,i);
end
% FFT
ff_sig=fft(rxed_sig',64)';
% pilot synch
g=0;
for p=1:1000
for i=1:13:52
J=i+1:i+12;
k=i-g:i+11-g;
synch_sig(p,k)=ff_sig(p,J);
g=g+1;
end
g=0;
end
for p=1:1000
m=53:64;
n=49:60;
synch_sig(p,n)=ff_sig(p,m);
end
%demodulation
demod_sig=pskdemod(synch_sig,2);
demod_sig=demod_sig(:);
hErr=comm.ErrorRate;
errop=step(hErr,data,demod_sig);

Answers (0)

Community Treasure Hunt

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

Start Hunting!