to plot graph of SNR Vs BER of QPSK based MIMO OFDM system

21 visualizaciones (últimos 30 días)
ABDUL
ABDUL el 25 de Jun. de 2019
Comentada: Sobia Omer el 1 de Jun. de 2022
Hello all......
i am trying to implement the QPSK based MIMO OFDM System and want to plot graph of SNR vs BER of the same . i am not getting it as a proper graph. kindly help me in this regards
M=4;
k=log2(M); % number of bits/symbol
number_of_data_points=64; % FFT Size or total number of subcarriers=N=64= IFFT size
block_size=16; % Block Size, no of rows,data subcarriers
BW=8*10^6; % Bandwidth of the OFDM system
Nsp=52;
%Derived Parameters
deltaf=BW/number_of_data_points;%bandwidth of each subcarriers including used and unused subacarriers
TFFT=1/deltaf; % ofdm_symbol_duration
TGI=TFFT/4; % duration of the cyclic prefix= guard interval duration 25% of the subcarriers to be used as a GI
% possible guard band values 1/4, 1/8, 1/16 and 1/32
Tsignal= TGI+TFFT ; % total ofdm symbol duration
Ncp=number_of_data_points*(TGI/TFFT); % length of the cyclic prefix
cp_len=ceil(0.25*block_size);
fft_points=number_of_data_points;
ifft_points=number_of_data_points;
Nt=2;
Nr=2;
cp_start=block_size-cp_len;
cp_end=block_size;
actual_cp=zeros(cp_len, block_size);
data_subcarriers=cp_start+Nsp;
nsf=8/7;
Fs=ceil(nsf*BW);
% initialization of SNR
SNRstart=0;
SNRincrement=1;
SNRend=25;
index=0;
%-------------------------------------------------------------------------%
%1. 1st Block -Implementation of binary data %
%1st Block -Implementation of bianry data- generation %
%-------------------------------------------------------------------------%
x1=randi([0 1],1,64);
br=BW; %Let us transmission bit rate 1000000
fc=br; % minimum carrier frequency
Tc=1/br; % bit duration
tmod=Tc/99:Tc/99:Tc; % Time vector for one bit information
H=[1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0;0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,0,0,0,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0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0;0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0;0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,1,0,0,0,0,0;1,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0;0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0;0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,1,1,0,0,0,1,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0;0,0,1,1,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,1,0,1,0,0,0,0,1,1,0,1,1];
%-------------------------------------------------------------------------%
%------- encoded data by using LDPC Encoder and Parity Check Matrix-------%
%-------------------------------------------------------------------------%
data_encoded=x1*H;
mod_data=mod(data_encoded,2);
%-------------------------------------------------------------------------%
%---------3. modulation of the data by using psk------------------------- %
%-------------------------------------------------------------------------%
data_NRZ=2*mod_data-1; % Data Represented at NZR form for QPSK modulation
s_p_data=reshape(data_NRZ,2,length(x1)/2); % S/P convertion of data
ymod=[];
ycomplex=[];
y_in=[];
y_qd=[];
for imod = 1:length(x1)/2
y1 = s_p_data(1,imod)*cos(2*pi*fc*tmod); % inphase component
y2 = s_p_data(2,imod)*sin(2*pi*fc*tmod) ;% Quadrature component
y_in = [y_in y1]; % inphase signal vector
y_qd = [y_qd y2]; %quadrature signal vector
ymod=[ymod y1+y2]; % modulated signal vector
ycomplex = [ycomplex (sign(y1))+(1i*sign(y2))];
end
psk_mod=ycomplex;
Tx_sig1=ymod; % transmitting signal after modulation
Tx_sig=ycomplex; % transmitting signal after modulation
Tx_sig_complex=ycomplex;
ttmod=Tc/99:Tc/99:(Tc*length(x1))/2;
% to find out the number of columns after reshaping
num_colums=(size(Tx_sig_complex,1)*size(Tx_sig_complex,2))/block_size;
%-------------------------------------------------------------------------%
% 5.to perform serial to parallel conversion %
%-------------------------------------------------------------------------%
reshaped_mod_data = reshape(Tx_sig1,[block_size, num_colums]);
%-------------------------------------------------------------------------%
% 6. To Perform IFFT and Cyclic Prefix %
% to create empty matrix to put ifft data %
% 7.operate column wise and do cyclic prefix, column wise cyclic prefix is done
%-------------------------------------------------------------------------%
for ireshape=1:num_colums
ifft_data_matrix(:,ireshape)=ifft(reshaped_mod_data(:,ireshape));
for jcplen= 1:cp_len % compute cyclic prefix data
actual_cp(jcplen,ireshape) = ifft_data_matrix(jcplen+cp_start,ireshape).';
end
ifft_data_after_cp(:,ireshape) = vertcat(actual_cp(:,ireshape),ifft_data_matrix(:,ireshape));% perform cyclic prefix
end
%-------------------------------------------------------------------------%
% 8. to perform parallel to serial conversion %
%-------------------------------------------------------------------------%
parallel_serial_tx = reshape(ifft_data_after_cp(:,:),size(ifft_data_after_cp(:,:),2),size(ifft_data_after_cp(:,:),1));
%-------------------------------------------------------------------------%
% 12. To find the number of rows and colums after ifft %
%-------------------------------------------------------------------------%
[ifft_rows,ifft_colums]=size(parallel_serial_tx);
ofdm_length=ifft_rows*ifft_colums;
%-------------------------------------------------------------------------%
% to convert to serial stream for to obtain OFDM Signal %
% to generate ofdm signal - begin %
%-------------------------------------------------------------------------%
ofdm_signal= reshape(parallel_serial_tx,1,ofdm_length) ;% serial_parallel_form = reshape( b,block_size,num_colums) ;1x130
received_bits=zeros(size(SNRstart:SNRincrement:SNRend));
index=0;
for snr=SNRstart:SNRincrement:SNRend
index=index+1;
%creation of multipath channel
channel = randn(size(parallel_serial_tx))+sqrt(-1)*randn(size(parallel_serial_tx));
% Pass the signal thru the channel
after_channel = filter(reshape(channel,1,[]),1,ofdm_signal);
%generate AWGN noise
awgn_noise=awgn(after_channel,snr,'measured');
% received signal
received_signal = after_channel+awgn_noise;
% To perform Serial to Parallel Conversion
serial_parallel_form_rx = reshape(received_signal,[ifft_rows,ifft_colums]).';%64x2
%To Remove Cyclic Prefix
serial_parallel_form_rx(1:cp_len,:,:)=[];
% To Perform FFT operation
receivd_signal_fft_rx=fft(serial_parallel_form_rx);
% To Perform Parallel to Serial Conversion
parallel_serial_form_rx= reshape(receivd_signal_fft_rx,1,[]);
% To pass through Demodulator
Rx_data=[];
Rx_sig=parallel_serial_form_rx; % Received signal
Rx_sig_real=sign(real(Rx_sig));
Rx_sig_imag=sign(imag(Rx_sig));
for (idemod=1:1:length(x1)/2)
%%XXXXXX inphase coherent dector XXXXXXX
Z_in=Rx_sig_real((idemod-1)*length(tmod)+1:idemod*length(tmod)).*cos(2*pi*fc*tmod);
% Z_in=Rx_sig_real(((idemod-1)*length(tmod)+1:idemod*length(tmod)).*cos(2*pi*fc*tmod));
% Z_in=Rx_sig_real((idemod-1)*length(tmod)+1:}.2demod*length(tmod)).*cos(2*pi*fc*tmod);
% above line indicat multiplication of received & inphase carred signal
Z_in_intg=(trapz(tmod,Z_in))*(2/Tc);% integration using trapizodial rull
if(Z_in_intg>0) % Decession Maker
Rx_in_data=1;
else
Rx_in_data=0;
end
%%XXXXXX Quadrature coherent dector XXXXXX
Z_qd=Rx_sig_imag(((idemod-1)*length(tmod))+1:idemod*length(tmod)).*sin(2*pi*fc*tmod);
%above line indicat multiplication ofreceived & Quadphase carred signal
Z_qd_intg=(trapz(tmod,Z_qd))*(2/Tc);%integration using trapizodial rull
if (Z_qd_intg>0)% Decession Maker
Rx_qd_data=1;
else
Rx_qd_data=0;
end
Rx_data=[Rx_data Rx_in_data Rx_qd_data]; % Received Data vector
end
psk_demod_mod=Rx_data;
Hinv=H.';
rece_decoder=psk_demod_mod*Hinv;
rece_decoder_mod=mod(rece_decoder,2);
% [n, received_bits(index)]=biterr(x1,psk_demod_mod);
[n, received_bits(index)]=biterr(x1,rece_decoder_mod);
end
snr=SNRstart:SNRincrement:SNRend;
%% Plotting BER vs SNR
figure (6)
semilogy(snr,(received_bits),'-ok');
grid;
title('OFDM Bit Error Rate .VS. Signal To Noise Ratio');
ylabel('BER');
xlabel('SNR [dB]');
  7 comentarios
Mohamad Bayaa
Mohamad Bayaa el 2 de Jun. de 2020
im finding the same issue did you get the answer?
ABDUL
ABDUL el 2 de Jun. de 2020
no i didnt get .... if you get it help me out ..

Iniciar sesión para comentar.

Respuesta aceptada

Maryan Yousif
Maryan Yousif el 22 de Jun. de 2020
Hi, did you solve the problem, if you solved the problem please can you please show me how you solved, thanks.
  2 comentarios
ABDUL
ABDUL el 24 de Jun. de 2020
no i didnt get the solution
ABDUL
ABDUL el 24 de Jun. de 2020
if you can help me out in this will be off great help

Iniciar sesión para comentar.

Más respuestas (1)

sonia benabdallah
sonia benabdallah el 19 de Sept. de 2020
hey please i have a question for you.I couldn't have the same figure as you.

Categorías

Más información sobre Synchronization and Receiver Design en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by