06.06.2022 Views

B. P. Lathi, Zhi Ding - Modern Digital and Analog Communication Systems-Oxford University Press (2009)

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

10.12 MATLAB Exercises 601

noiseq=randn(L,2) ;

BER= [ ];

BER_az= [ ];

% Generating the channel noise (AWGN )

for i=l :12,

Eb2N (i)=i ; %(Eb/N in dB )

Eb2N_num=10 (Eb2N(i) /10) ; % Eb/N in numeral

Var_n=l/ (2*Eb2N_num) ;

%1/SNR is the noise variance

signois=sqrt (Var_n) ;

% standard deviation

awgnois=signois* (noisei+j *noiseq) ; % AWGN complex channels

% Add noise to signals at the channel output

ychout=xmodsig+awgnois;

% Non-coherent detection

ydiml=abs (ychout (:,1));

ydim2 =abs (ychout (:,2 ));

dec= (ydiml>ydim2 );

% Compute BER from simu lation

BER= [BER; sum(dec~=s_data) /L] ;

% Compare against analytical BER .

BER_az= [BER_az ; 0.5* exp (-Eb2N_num/2) ];

end

figber=semilogy (Eb2N, BER_az , 'k-',Eb2N, BER, 'k- o') ;

set ( figber , 'Linewidth ' , 2) ;

legend('Analytical BER' , 'Noncoherent FSK simulation' );

fx=xlabel ('E_b /N (dB) ');

fy=ylabel ('Bit error rate' );

set (fx, 'FontSize' , 11) ; set (fy, 'Fontsize' , 11) ;

COMPUTER EXERCISE 10.5: NONCOHERENT DETECTION OF BINARY

DIFFERENTIAL PSK

To test the results of a binary differential phase shift keying system, we present MATLAB program

Exl 0_5 . m. As in previous cases, the measured BER results in Figure 10.52 matches the analytical BER

results very well.

% MATLAB PROGRAM <Exl0 5.m>

% This program provides simulation for dif ferential detection of

% binary DPSK . Dif ferential detetion only needs to compare the

% successive phases of the signal samples at the receiver

%

clear;clf

L=l000000;

%Number of data symbols in the simulation

s_data=round (rand (L, l) );

% Generating initial random phase

initphase= [2*rand] ;

% dif ferential modulation

s_denc=mod (cumsum ( [0;s_data] ) ,2) ;

% define the phase divisible by pi

xphase=initphase+s_denc ;

clear s_denc ;

% modulate the phase of the signal

xmodsig=exp (j*pi*xphase); clear xphase;

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!