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.

2.8 MATLAB Exercises 51

subplot (231) ; sigl=plot (t,x, 'k');

xlabel ('\it t'); ylabel ('{\it x} ({\it t} ) '); % Label axis

set (sigl, 'Linewidth ' , 2);

% change linewidth

axis ([-.5 6 -1.2 1.2]); grid

% set plot range

subplot (232); sig2=plot (t,gl, 'k');

xlabel ('\it t' ); ylabel ('{\it g}_l({\it t}) ');

set ( sig2 , 'Linewidth ' , 2);

axis ([-.5 6 -1.2 1.2] ); grid

subplot (233); sig3 =plot (t,g2 , 'k');

xlabel ('\it t' ); ylabel ('{\it g } _2 ( {\it t}) ');

set (sig3 , 'Linewidth ' , 2);

axis ([-.5 6 -1.2 1.2]); grid

subplot (23 4) ; sig4=plot (t,g3 , 'k');

xlabel ('\it t'); ylabel ('{\it g } _3 ( {\it t} ) ');

set (sig4 , 'Linewidth ' , 2);

axis ([-.5 6 -1 .2 1.2]); grid

subplot (235) ; sig5=plot (t,g4, 'k');

xlabel ('\it t'); ylabel ('{\it g}_4({\it t}) ');

set (sig5 , 'Linewidth ' , 2) ;grid

axis ( [ - . 5 6 -1. 2 1. 2] ) ;

subplot (236) ; sig6=plot (t,g5, 'k');

xlabel ('\it t'); ylabel ('{\it g }_5({ \it t}) '};

set (sig6 , 'Linewidth' , 2);grid

axis ([-.5 6 -1.2 1.2] };

% Computing signal energies

EO=sum(x.*conj (x) )*Dt ;

El=sum(gl .*conj (gl) )*Dt;

E2=sum(g2 .*conj (g2))*Dt;

E3=sum(g3 .*conj ( g3 ) )*Dt;

E4=sum(g4 .*conj (g4 ) )*Dt;

E5=sum(g5 .*conj (g5) )*Dt;

cO=sum(x.*conj (x) ) *Dt/ ( sqrt (EO*EO) )

cl=sum(x.*conj (gl ) )*Dt/ (sqrt (EO*El) )

c2=sum(x.*conj (g2) ) *Dt/ (sqrt (EO*E2))

c3=sum(x.*conj ( g3 ))*Dt/ (sqrt (EO*E3 ))

c4=sum(x.*conj ( g4 ) )*Dt/ (sqrt (EO *E4) )

c5=sum(x.*conj (g5 ) )*Dt/ (sqrt (EO*E5) )

co =

The six correlation coefficients are obtained from the program as

1

cl

1

c2 =

-1

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

Saved successfully!

Ooh no, something went wrong!