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.

11.9 MATLAB Exercises 659

y_out=x_in+awgnois;

Y_out=reshape (y_out ,Lc,Ldata) .';

clear y_out awgnois;

% Despread first

z_out=Y_out*pcode ;

% Decision based on the sign of the samples

dec=sign (real ( z_out ))+j * sign ( imag ( z_out) );

% Now compare against the original data to compute BER

BERl= [BERl ;sum ( [real (data_syrn (:,l) )~=real (dec (:,l) ) ; ...

imag ( data_syrn (:,l))~=imag (dec ( : ,l))J ) / (2*Ldata) J ;

BER2=[BER2 ;sum ( [real (data_syrn ( : ,2))~=real (dec ( : ,2));...

imag ( data_syrn (:,2)) - =imag (dec (:,2) ) ] ) / (2*Ldata) ];

BER3=[BER3 ;sum([real (data_syrn(:,3) )~=real (dec ( : ,3));...

imag (data_syrn ( : ,3)) - =imag (dec ( : ,3) ) ] ) / (2*Ldata) J ;

BER4= [BER4 ;sum ( [real (data_syrn (:,4) ) -=real (dec ( : ,4));...

imag ( data_syrn (:,4)) - =imag (dec ( : ,4) ) ] ) / (2* Ldata) ];

BER_az= [ BER_az ;0.5*erfc ( sqrt (Eb2N_num) )l;

%analytical

end

BER= [ BERl BER2 BER3 BER4 ] ;

figure (l)

figber=semilogy (Eb2N, BER_az, 'k-',Eb2N, BER1 , 'k-o' ,Eb2N,BER2 , 'k-s',...

Eb2N,BER3 , ' k-v ' , Eb2N, BER4 , 'k- * ');

legend ('Single-user (analysis)','User 1 BER' , 'User 2 BER' ,

'User 3 BER' , 'User 4 BER' )

axis ([O 12 0.99e-5 1.eO ] );

set ( figber, 'LineWidth ' , 2) ;

xlabel ('E_b /N (dB) ');ylabel ('QPSK bit error rate')

title ('4-user CDMA BER with Gold code of length 31' );

COMPUTER EXERCISE 11 .4: MULTIUSER CDMA DETECTION

IN NEAR-FAR ENVIRONMENT

We can now modify the program in Computer Exercise l 1.3 to include the near-far effect. Among the

four users, user 2 and user 4 have the same power and are the weaker users from far transmitters. User

l is l O dB stronger, while user 3 is 7 dB stronger. In this near-far environment, both users 2 and 4 suffer

from strong interference (users 1 and 3) signals due to the lack of code orthogonality. Note that the two

weak users do not have the same level of multiuser interference (MUI) from other users because of the

difference in their correlations.

MATLAB program Exl 1_ 4a. mcompares the performance of the conventional single-user receiver

with the performance of the decorrelator multiuser detector (MUD) described in Sec. 11. 7. We show the

performance results of user 2 and user 4 in Fig. 11.26.

% MATLAB PROGRAM <Exll 4a .m>

% This program provides simulation for multiuser CDMA system

% that experiences the near-far effect due to user Tx power

% variations .

%

% Decorrelator receivers are

% applied to mitigate the near-far effect

%

%clear;clf

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

Saved successfully!

Ooh no, something went wrong!