Professional Documents
Culture Documents
FINAL REPORT
TOPIC: MULTIPLE ACCESS OF CDMA FOR TWO USERS IN ADDITIVE WHITE GAUSSIAN NOISE.
JUNE 2011
INTRODUCTION:
CDMA known as the code division multiple access, is a channel method access that is used by different radio communication technologies. CDMA uses spread spectrum technology, and also a special coding scheme. This coding scheme is the one by which the transmitter is assigned a code, to allow multiple users to be multiplexed over the same physical channel of homogeneity. In other words, CDMA is a form of spread spectrum signaling because of the modulated code, the signal has a much higher bandwidth than the data that was communicated.
For the signal to be protected, we use a pseudo-random code. It is actually deterministic, because the receiver can reconstruct the code for synchronous detection. Pseudo-Random is also known as Pseudo-Noise (PN).
There are three ways to spread the signal bandwidth in CDMA; Frequency hopping: Signal is switched between different frequencies within the hopping bandwidth in pseudo-random manner, and the receiver predicts where to find the signal any time. Time hopping: Signal is transmitted in short pseudo-random bursts. The receiver knows when to expect the signals.
Direct sequence: The Digital data is directly coded at almost more higher frequency. The code is generated pseudo randomly, and receiver knows how to generate the same code, and correlates the code with the received signal.
ALGORITHM:
The algorithm that realizes the multiple access of CDMA in additive white Gaussian Noise is shown according to the following steps. Matlab Function CDMA (); it will accept augments; 2 Users and SNR in Decibel. Conversion of Binary sequence of each user to non-return-to-zero format.(NRZ). Codes for the CDMA transmitter and baseband for each of the users. Codes for PN generation of the users. Codes for creating BPSK modulation for each of the user. Plot to observe the FFT of BPSK sequence for each of the user. Codes for actualizing the AWGN channel. Codes for actualizing the Demodulation of the users sequences. Codes for Demodulating the BPSK sequence of each of the users.
for i=1:length_user1 if user1(i)==0 user1(i)=-1; end end for i=1:length_user2 if user2(i)==0 user2(i)=-1; end end fc=1; %%carrier frequency eb=2; %% energy per bit tb=1; %% time per bit of message sequence %%% CDMA transmitter for user1 t=0.01:0.01:tb*length_user1; %0.01 %%plotting base band signal for user1 basebandsig1=[]; for i=1:length_user1 for j=0.01:0.01:tb%0.01 if user1(i)==1 basebandsig1=[basebandsig1 1]; else basebandsig1=[basebandsig1 -1]; end end end figure plot(basebandsig1) axis([0 100*length_user1 -1.5 1.5]); title('original binary sequence for user1') %%%% BPSK MODULATION FOR USER 1 bpskmod1=[]; for i=1:length_user1 for j=0.01:0.01:tb bpskmod1=[bpskmod1 sqrt(2*eb)*user1(i)*cos(2*pi*fc*j)]; end end length(bpskmod1) figure plot(bpskmod1) %axis([0 100*length_user1 -2 2]); title(' BPSK signal for user 1 ') %% plot fft of BPSK sequence % figure % plot(real(fft(bpskmod1))) % title('FFT of BPSK signal for user1') %% PN generator for user1 %% let initial seed for user1 is 1000
seed1=[1 -1 1 -1]; %convert it into bipolar NRZ format spreadspectrum1=[]; pn1=[]; for i=1:length_user1 for j=1:10 %chip rate is 10 times the bit rate pn1=[pn1 seed1(4)]; if seed1 (4)==seed1(3) temp=-1; else temp=1; end seed1(4)=seed1(3); seed1(3)=seed1(2); seed1(2)=seed1(1); seed1(1)=temp; end % spreadspectrum1=[spreadspectrum1 user1(i)*pn1]; end % each bit has 100 samples. and each pn chip has 10 samples. there r % 10 chip per bit there fore size of pn samples and original bit is same pnupsampled1=[]; len_pn1=length(pn1); for i=1:len_pn1 for j=0.1:0.1:tb if pn1(i)==1 pnupsampled1=[pnupsampled1 1]; else pnupsampled1=[pnupsampled1 -1]; end end end length_pnupsampled1=length(pnupsampled1); sigtx1=bpskmod1.*pnupsampled1; figure plot(sigtx1) %axis([0 100*length_user1 -2 2]); title(' spread spectrum signal transmitted for user 1 ') %% plot fft of BPSK sequence figure plot(real(fft(sigtx1))) title('FFT of spread spectrum signal transmitted for user1') % % % % % rxcode1=pnupsampled1.*sigtx1; figure plot(rxcode1) %axis([0 100*length_user1 -2 2]); title(' spread spectrum signal transmitted for user 1')
% CDMA transmitter for user2 t=0.01:0.01:tb*length_user2; %0.01 %plotting base band signal for user2
basebandsig2=[]; for i=1:length_user2 for j=0.01:0.01:tb%0.01 if user2(i)==1 basebandsig2=[basebandsig2 1]; else basebandsig2=[basebandsig2 -1]; end end end figure plot(basebandsig2) axis([0 100*length_user2 -1.5 1.5]); title('original binary sequence for user2') % BPSK MODULATION FOR USER 2 bpskmod2=[]; for i=1:length_user2 for j=0.01:0.01:tb bpskmod2=[bpskmod2 sqrt(2*eb)*user2(i)*cos(2*pi*fc*j)]; end end figure plot(bpskmod2) %axis([0 100*length_user2 -2 2]); title(' BPSK signal for user 2') %% plot fft of BPSK sequence % figure % plot(real(fft(bpskmod2))) % title('FFT of BPSK signal for user2') %% PN generator for user2 %% let initial seed for user2 is 1000 seed2=[-1 1 -1 1]; %convert it into bipolar NRZ format spreadspectrum2=[]; pn2=[]; for i=1:length_user2 for j=1:10 %chip rate is 10 times the bit rate pn2=[pn2 seed2(4)]; if seed2 (4)==seed2(3) temp=-1; else temp=1; end seed2(4)=seed2(3); seed2(3)=seed2(2); seed2(2)=seed2(1); seed2(1)=temp; end % spreadspectrum2=[spreadspectrum2 user2(i)*pn2]; end pnupsampled2=[]; len_pn2=length(pn2); for i=1:len_pn2 for j=0.1:0.1:tb
if pn2(i)==1 pnupsampled2=[pnupsampled2 1]; else pnupsampled2=[pnupsampled2 -1]; end end end length_pnupsampled2=length(pnupsampled2); sigtx2=bpskmod2.*pnupsampled2; figure plot(sigtx2) %axis([0 100*length_user2 -2 2]); title(' spread spectrum signal transmitted for user 2 ') %% plot fft of BPSK sequence figure plot(real(fft(sigtx2))) title('FFT of spread spectrum signal transmitted for user2') % % % % % rxcode2=pnupsampled2.*sigtx2; figure plot(rxcode2) %axis([0 100*length_user2 -2 2]); title(' spread spectrum signal transmitted for user 2 ')
%% SNR of % dbs
%DMODULATION FOR USER 1 rx1=composite_signal.*pnupsampled1; figure plot(rx1) title(' rx1 ') % BPSK DEMODULATION FOR USER 1 demodcar1=[]; for i=1:length_user1 for j=0.01:0.01:tb demodcar1=[demodcar1 sqrt(2*eb)*cos(2*pi*fc*j)]; end end bpskdemod1=rx1.*demodcar1; figure plot(bpskdemod1) title('o/p of bpsk demod for user 1 ') len_dmod1=length(bpskdemod1); sum=zeros(1,len_dmod1/100); for i=1:len_dmod1/100 for j=(i-1)*100+1:i*100 sum(i)=sum(i)+bpskdemod1(j);
end end sum; rxbits1=[]; for i=1:length_user1 if sum(i)>0 rxbits1=[rxbits1 1]; else rxbits1=[rxbits1 0]; end end rxbits1 %DMODULATION FOR USER 2 rx2=composite_signal.*pnupsampled2; figure plot(rx2) title(' rx2 ') % BPSK DEMODULATION FOR USER 2 demodcar2=[]; for i=1:length_user2 for j=0.01:0.01:tb demodcar2=[demodcar2 sqrt(2*eb)*cos(2*pi*fc*j)]; end end bpskdemod2=rx2.*demodcar2; figure plot(bpskdemod2) title('o/p of bpsk demod for user 2 ') len_dmod2=length(bpskdemod2); sum=zeros(1,len_dmod1/100); for i=1:len_dmod2/100 for j=(i-1)*100+1:i*100 sum(i)=sum(i)+bpskdemod2(j); end end sum; rxbits2=[]; for i=1:length_user2 if sum(i)>0 rxbits2=[rxbits2 1]; else rxbits2=[rxbits2 0]; end end rxbits2
0.5
-0.5
-1
-1.5
10
20
30
40
50
60
70
80
90
100
10
20
30
40
50
60
70
80
90
100
Fig 2: Plot showing the BPSK signal for the 1st user.
2 1.5 1 0.5 0 -0.5 -1 -1.5 -2 -2.5 x 10
5
10
20
30
40
50
60
70
80
90
100
x 10
-2
-4
-6
-8
-10
10
20
30
40
50
60
70
80
90
100
Fig 4: Plot of FFT of spread spectrum of transmitted signal for the 1st user.
original binary sequence for user2 1.5
0.5
-0.5
-1
-1.5
10
20
30
40
50
60
70
80
90
100
10
20
30
40
50
60
70
80
90
100
x 10
10
20
30
40
50
60
70
80
90
100
Fig 7:Plot of the spread spectrum of the transmitted signal for 2nd user.
x 10
-2
-4
-6
-8
10
20
30
40
50
60
70
80
90
100
Fig 8: Plot of FFT of the spread spectrum signal transmitted for the 2nd user.
5 4 3 2 1 0 -1 -2 -3 -4 -5
x 10
rx1
10
20
30
40
50
60
70
80
90
100
9 8 7 6 5 4 3 2 1 0 -1
x 10
10
20
30
40
50
60
70
80
90
100
rx2
10
20
30
40
50
60
70
80
90
100
9 8 7 6 5 4 3 2 1 0 -1
10
20
30
40
50
60
70
80
90
100
Fig 12: The output BPSK demodulation for the 2nd user.