hayet1991
Newbie level 3
- Joined
- May 8, 2015
- Messages
- 3
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1
- Activity points
- 17
i made some modifications to my code of wimax physical layer in order to add MIMO it runs perfectly except that the simulated bit error rate curve is wrong and i cant figure out what is the problem.could you please help me
Code:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Name: deepwimaxmain.m %%
%% In this the main file to simulate wimax PHY layer %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clc
close all
clear all
disp(' *******************************************************************************************');
disp(' * *');
disp(' * M.Tech dissertation *');
disp(' * *');
disp(' * "Characterization of Physical Layer in IEEE 802.16e Standards" *');
disp(' * *');
disp(' * Study Done by Deepak Kumar Rathore *');
disp(' * Deptt. of ECE, NIT Kurukshetra *');
disp(' *******************************************************************************************');
disp(' ');
disp('---> To do Simulate different modulation please enter ur choice:');
disp(' ');
disp(' --------------------------------------------------------------------------------------------------');
disp(' | Modulation | BPSK 1/2 | QPSK 1/2 | QPSK 3/4 | 16-QAM 1/2 | 16-QAM 3/4 | 64-QAM 2/3 | 64QAM-3/4 |')
disp(' |------------|----------|----------|----------|------------|------------|------------|-----------|');
disp(' | rate_id | 0 | 1 | 2 | 3 | 4 | 5 | 6 |');
disp(' --------------------------------------------------------------------------------------------------');
disp(' ');
rate_id=input(' Please enter the rate_id = ');
disp(' ');
G=input(' Please select the value of G(Cyclic Prefix) [1/4 1/8 1/16 1/32] G= ');
disp(' ');
no=input(' please enter number of ofdm symbol (eg. 10 50 100) no= ');
disp(' ');
disp(' Realizing the simulation... Please wait a while.....');
bit_error_rate=[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0];
SNR=[1 2 3 5 7 9 10 12 15 17 20 22 25 27 30]; % specify SNR
for q=1:no
for p=1:1:15
Nt=2; Nr=2; %
Nsc=192; %%% nb carrier
K=2; %STBC longueur codage
K_Nsc = K*Nsc;
L=4;
Nfft = 256;
%%% data generation
data_get =data_gen(rate_id);
%%% data randomization
data_rand=randomizer(data_get);
%%% FEC ENCODER
data_rscoded=rsencodecod(data_rand,rate_id,10);
%%convolution encoder
data_coded=convolution(data_rscoded,rate_id,10);
%%% INTERLEAVING
data_interleav=interleav_d(data_coded,rate_id);
%%% Digital modulator SYMBOL MAPPER
data_mod=mod_d(data_interleav,rate_id);
%h=scatterplot(data_mod); title('CONSTELLATION');
data_mod = reshape(data_mod,Nt,length(data_mod)/Nt);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%% alamouti %%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
symbol_Tx_out = [];
ant1 = data_mod(1,:) ;
ant2 = data_mod(2,:) ;
ant1_out = [ant1; -conj(ant2)]; % ant transmitter1
ant2_out = [ant2; conj(ant1)]; % ant transmitter2
ant1_out = ant1_out(:).' ; % P/S
ant2_out = ant2_out(:).' ;
%%% converssion s/p pour ifft %%
symbol_sp1 = reshape(ant1_out, Nsc,length( ant1_out)/Nsc); % S/P
symbol_sp2 = reshape( ant2_out, Nsc,length( ant2_out)/Nsc);
%---------S / P converti en une forme appropriée pour la matrice DFT -------%
% for ift=1:Nsc
% temp1 = symbol_sp1(2*ift-1:2*ift,:);
% symbol_ifft1 = temp1(:).' ;
% symbol_IFFT1(ift,:) = symbol_ifft1;
% temp2 = symbol_sp2(2*ift-1:2*ift,:);
% symbol_ifft2 = temp2(:).' ;
% symbol_IFFT2(ift,:) = symbol_ifft2;
%end
%%% IFFT modulator
symbol_IFFT1_out=ofdmsymbol_fft_cp( symbol_sp1,G,10);
symbol_IFFT2_out=ofdmsymbol_fft_cp( symbol_sp2,G,10);
%%%%% conversion p/s %%
symbol_tx1 = reshape( symbol_IFFT1_out,1,[]);%P/S
symbol_tx2 = reshape( symbol_IFFT2_out,1,[]);
symbol_Tx_out = [symbol_Tx_out; symbol_tx1; symbol_tx2]; %%% assembler les 2 antenn emission: Transmettre matrice de signaux
symbols_tx=symbol_Tx_out;
%---------------- canal ------------------------
h=(randn(Nt*Nr,L)+ 1i*randn(Nt*Nr,L))/sqrt(2);
h=h.*(ones(Nt*Nr,1)*(exp(-0.5).^[1:L]));
h=h./(sqrt(sum(abs(h).^2,2))*ones(1,L));
CL=size(h,2); % Longueur de canal
symbols_rx=zeros(Nr,length(symbols_tx));
for nr=1:Nr
for nt=1:Nt
symbols_rx_conv=conv(symbols_tx(nt,:),h((nr-1)*Nt+nt,:)); % convolution
symbols_rx(nr,:)=symbols_rx(nr,:)+ symbols_rx_conv(1:end-L+1);
end
%%--------plus le bruit --------%
symbols_rx(nr,:)=awgn(symbols_rx(nr,:),SNR(p));
%-------- reception --------% %%% FFT demodulator
%%%% à vérifier
symbols_ifft=reshape(symbols_rx(nr,:),Nfft+G*Nfft,[]);%S/P
symbols_freq(:,:,nr)=ofdmsymbol_fft_cp(symbols_rx(nr,:),G,01); % FFT
%SNR=[1 2 3 5 7 9 10 12 15 17 20 22 25 27 30]; % specify SNR
%for p=1:length(SNR)
%%% channel
%% data_rx=channel_d(data_tx,snr);
%%% FFT demodulator
%% data_rxp=ofdmsymbol_fft_cp(data_rx,G,01);
%%% Digital demodulator SYMBOL DEMEPPER
data_demod=demod_d( symbols_freq(:,:,nr),rate_id);
%%% DEINTERLEAVING
data_deinterleav=deinterleav_d(data_demod,rate_id);
% %%% FEC DECODER
%% convolution decoder
data_decoded=convolution(data_deinterleav,rate_id,01);
%%% RSdecoder
data_rsdecoded=rsencodecod(data_decoded,rate_id,01); % removing added tail bits
%%% Data Derandomizer
data_unrand=randomizer(data_rsdecoded);
%% BER calculation
[noerr(p),ber(p)] = biterr(data_unrand,data_get);
end
end
bit_error_rate=bit_error_rate+ber;
end
bit_error_rate=bit_error_rate/no
%%plot the grapgh
result=berplot(SNR,bit_error_rate,rate_id)
Last edited by a moderator: