Bit Error Ratio (BER) Curve for 8-PSK (Phase Shift Keying) for AWGN Channel

%The bit error ratio (also BER) is the number of bit errors divided by the total number of transferred its during a studied time interval. 
%Additive white Gaussian noise (AWGN) is a basic noise model used in Information theory to mimic the effect of many random processes that occur in nature.

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^3;    % number of symbols
len_fft     = 64;         % fft size
sub_car     = 52;       % number of data subcarriers
EbNo        = 0:2:12;
k=3;
EsNo= EbNo + 10*log10(52/64)+ 10*log10(64/80) + 10*log10(k); % symbol to noise ratio

snr=EsNo - 10*log10(52/64); % 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

no_of_error=[];
ratio=[];
for ii=1:length(snr)

chan_awgn = sqrt(80/52)*awgn(ser_data,snr(ii),'measured'); % awgn addition

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

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

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) ; % error rate calculation

end

% plotting the result

semilogy(EbNo,ratio,'--or','linewidth',2);
hold on;
theoryBer = berawgn(EbNo,'psk',2^k,'nondiff');
semilogy (EbNo,theoryBer,'--*b','linewidth',2);
legend('simulated','theoritical')
grid on
% axis([0 12 10^-5 .1])
xlabel('EbNo');
ylabel('BER')
title('Bit error probability curve for 8-PSK using OFDM (AWGN)');

Results:
Bit Error Ratio (BER) Curve for 8-PSK (Phase Shift Keying) for Rayleigh Channel
Bit Error Ratio (BER) Curve for 8-PSK (Phase Shift Keying) for Rayleigh Channel

0 comments: