Bit Error Ratio (BER) Curve for 8-PSK (Phase Shift Keying) OFDM for Rayleigh Channel
%The bit error ratio (also BER) is the number of bit errors divided by the total number of transferred bits during a studied time interval.
%The delays associated with different signal paths in a multipath fading channel change in an unpredictable manner and can only be characterized statistically. When there are a large number of paths, the central limit theorem can be applied to model the time-variant impulse response of the channel as a complex-valued Gaussian random process. When the impulse response is modeled as a zeromean complex-valued Gaussian process, the channel is said to be a Rayleigh fading channel.
MATLAB Code:
close all
clear all
clc
nbitpersym = 52; % number of bits per OFDM symbol (same as the number of subcarriers for BPSK)
nsym = 10^4; % number of symbols
len_fft = 64; % fft size
sub_car = 52; % number of data subcarriers
EbNo = 0:5:30;
k=3;
EsNo= EbNo + 10*log10(52/64)+ 10*log10(64/80)+ 10*log10(k); % symbol to noise ratio
snr= EsNo - 10*log10(64/80); % snr as to be used by awgn fn.
hh = modem.pskmod('M',2^k,'InputType','Bit','SymbolOrder','gray'); % modulation object
% Generating data
t_data=randi([0 1],nbitpersym*nsym*k,1);
% modulating data
mod_data = modulate(hh,t_data);
% serial to parallel conversion
par_data = reshape(mod_data,nbitpersym,nsym).';
% pilot insertion
pilot_ins_data=[zeros(nsym,6) par_data(:,[1:nbitpersym/2]) zeros(nsym,1) par_data(:,[nbitpersym/2+1:nbitpersym]) zeros(nsym,5)] ;
% fourier transform time doamain data and normalizing the data
IFFT_data = (64/sqrt(52))*ifft(fftshift(pilot_ins_data.')).';
% addition cyclic prefix
cylic_add_data = [IFFT_data(:,[49:64]) IFFT_data].';
% parallel to serial coversion
ser_data = reshape(cylic_add_data,80*nsym,1);
% passing thru channel
h=rayleighchan(1/10000,10);
changain1=filter(h,ones(nsym*80,1));
a=max(max(abs(changain1)));
changain1=changain1./a;
chan_data = changain1.*ser_data;
no_of_error=[];
ratio=[];
for ii=1:length(snr)
chan_awgn = awgn(chan_data,snr(ii),'measured'); % awgn addition
chan_awgn =a* chan_awgn./changain1; % assuming ideal channel estimation
ser_to_para = reshape(chan_awgn,80,nsym).'; % serial to parallel coversion
cyclic_pre_rem = ser_to_para(:,[17:80]); %cyclic prefix removal
FFT_recdata =(sqrt(52)/64)*fftshift(fft(cyclic_pre_rem.')).'; % freq domain transform
% FFT_recdata = FFT_recdata./FFT_recdata1;
rem_pilot = FFT_recdata (:,[6+[1:nbitpersym/2] 7+[nbitpersym/2+1:nbitpersym] ]); %pilot removal
ser_data_1 = reshape(rem_pilot.',nbitpersym*nsym,1); % serial coversion
% ser_data_1 = ser_data_1./abs(FFT_recdata1);
z=modem.pskdemod('M',2^k,'OutputType','Bit','SymbolOrder','gray'); %demodulation object
demod_Data = demodulate(z,ser_data_1); %demodulating the data
[no_of_error(ii),ratio(ii)]=biterr(t_data,demod_Data) ;
end
% plotting the result
semilogy(EbNo,ratio,'--or','linewidth',2);
hold on;
% EbN0Lin = 10.^(EbNo/10);
theoryBer = berfading(EbNo,'psk',2^k,1);
semilogy(EbNo,theoryBer,'--ob','linewidth',2);
legend('simulated','theoritical')
grid on
xlabel('EbNo');
ylabel('BER')
title('Bit error probability curve for 8-PSK using OFDM (Rayleigh Channel)');
Result:
%The delays associated with different signal paths in a multipath fading channel change in an unpredictable manner and can only be characterized statistically. When there are a large number of paths, the central limit theorem can be applied to model the time-variant impulse response of the channel as a complex-valued Gaussian random process. When the impulse response is modeled as a zeromean complex-valued Gaussian process, the channel is said to be a Rayleigh fading channel.
MATLAB Code:
close all
clear all
clc
nbitpersym = 52; % number of bits per OFDM symbol (same as the number of subcarriers for BPSK)
nsym = 10^4; % number of symbols
len_fft = 64; % fft size
sub_car = 52; % number of data subcarriers
EbNo = 0:5:30;
k=3;
EsNo= EbNo + 10*log10(52/64)+ 10*log10(64/80)+ 10*log10(k); % symbol to noise ratio
snr= EsNo - 10*log10(64/80); % snr as to be used by awgn fn.
hh = modem.pskmod('M',2^k,'InputType','Bit','SymbolOrder','gray'); % modulation object
% Generating data
t_data=randi([0 1],nbitpersym*nsym*k,1);
% modulating data
mod_data = modulate(hh,t_data);
% serial to parallel conversion
par_data = reshape(mod_data,nbitpersym,nsym).';
% pilot insertion
pilot_ins_data=[zeros(nsym,6) par_data(:,[1:nbitpersym/2]) zeros(nsym,1) par_data(:,[nbitpersym/2+1:nbitpersym]) zeros(nsym,5)] ;
% fourier transform time doamain data and normalizing the data
IFFT_data = (64/sqrt(52))*ifft(fftshift(pilot_ins_data.')).';
% addition cyclic prefix
cylic_add_data = [IFFT_data(:,[49:64]) IFFT_data].';
% parallel to serial coversion
ser_data = reshape(cylic_add_data,80*nsym,1);
% passing thru channel
h=rayleighchan(1/10000,10);
changain1=filter(h,ones(nsym*80,1));
a=max(max(abs(changain1)));
changain1=changain1./a;
chan_data = changain1.*ser_data;
no_of_error=[];
ratio=[];
for ii=1:length(snr)
chan_awgn = awgn(chan_data,snr(ii),'measured'); % awgn addition
chan_awgn =a* chan_awgn./changain1; % assuming ideal channel estimation
ser_to_para = reshape(chan_awgn,80,nsym).'; % serial to parallel coversion
cyclic_pre_rem = ser_to_para(:,[17:80]); %cyclic prefix removal
FFT_recdata =(sqrt(52)/64)*fftshift(fft(cyclic_pre_rem.')).'; % freq domain transform
% FFT_recdata = FFT_recdata./FFT_recdata1;
rem_pilot = FFT_recdata (:,[6+[1:nbitpersym/2] 7+[nbitpersym/2+1:nbitpersym] ]); %pilot removal
ser_data_1 = reshape(rem_pilot.',nbitpersym*nsym,1); % serial coversion
% ser_data_1 = ser_data_1./abs(FFT_recdata1);
z=modem.pskdemod('M',2^k,'OutputType','Bit','SymbolOrder','gray'); %demodulation object
demod_Data = demodulate(z,ser_data_1); %demodulating the data
[no_of_error(ii),ratio(ii)]=biterr(t_data,demod_Data) ;
end
% plotting the result
semilogy(EbNo,ratio,'--or','linewidth',2);
hold on;
% EbN0Lin = 10.^(EbNo/10);
theoryBer = berfading(EbNo,'psk',2^k,1);
semilogy(EbNo,theoryBer,'--ob','linewidth',2);
legend('simulated','theoritical')
grid on
xlabel('EbNo');
ylabel('BER')
title('Bit error probability curve for 8-PSK using OFDM (Rayleigh Channel)');
Result:
Bit Error Ratio (BER) Curve for 8-PSK (Phase Shift Keying) for Rayleigh Channel |
0 comments: