06.06.2022 Views

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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

10.12 MATLAB Exercises 595

set (figwave l, 'Linewidth ' , 2) ;

subplot (212 )

figwave2=plot (t,xorth ( delayrt : delayrt+l99) );

title ('(b) Orthogonal modulation .')

set ( figwave2 , 'Linewidth ' , 2);

% Find the signal length

Lrcos=length (xrcos) ;Lrect=length (xorth) ;

BER= [ l ;

noiseq=randn(Lrcos,l) ;

% Generating the channel noise (AWGN )

for i=l:12,

Eb2N (i)= i;

%(Eb/N in dB)

Eb2N_num=l0 A (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*noiseq;

% AWGN

% Add noise to signals at the channel output

yrcos=xrcos+awgnois/sqrt (2) ;

yorth=xorth+awgnoi s(l:Lrect) ;

% Apply matched filters first

zl=conv (yrcos, pcmatch) ;clear awgnois, yrcos;

z2=conv (yorth, phmatch) ;

z3=conv (yorth , psmatch ) ;clear yorth;

% Sampling the received signal and acquire samples

zl=zl (delayrc+l: f_ovsamp:end) ;

z2=z2 (delayrt+l: f_ovsamp :end-f_ovsamp+l) ;

z3=z3 (delayrt+l: f_ovsamp :end-f_ovsamp+l) ;

% Decision based on the sign of the samples

decl=round ((sign(zl(l:L)-0.5)+1)*.5) ;dec2=round( (sign(z2-z3)+1)*.5) ;

% Now compare against the original data to compute BER for

% the three pulses

BER= [BER;sum(abs ( s_data-decl) )/L sum (abs ( s_data-dec2))/L ] ;

Q(i)= 0.5* erfc ( sqrt (Eb2N_num/2) ); % Compute the Analytical BER

end

figure (2)

subplot (ll l)

figber=semil ogy (Eb2N,Q, 'k-',Eb2N,BER( : ,l) , 'b-*' , Eb2N,BER(: ,2) , 'r-o') ;

fleg=legend ('Analytical ', 'Root-raised cosine on/off', 'Orthogonal

signaling');

fx=xlabel ('E_b/N (dB) ');fy=ylabel ('BER ' );

set ( figber, 'Linewidth' , 2) ;set ( fleg, 'FontSize' , 11) ;

set (fx, 'FontSize' , 11) ;

set(fy, 'FontSize' , 11) ;

% We can plot the individual pulses used for the binary orthogonal

% signaling

figure (3)

subplot (111) ;

pulse=plot ((0:f_ovsamp )/f_ovsamp , [psinh 0] , 'k-', ...

(0:f_ovsamp )/f_ovsamp , [psine 0 ] , ' k-o' );

pleg=legend ('Half-sine pulse ', 'Sine pulse');

ptitle=title ('Binary orthogonal signals');

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

Saved successfully!

Ooh no, something went wrong!