1、Report forexp2扩频通信流程matlab仿真 Background knowledgeSpread Spectrum:Form the formular, we can see that to obtain a same capacity, we can increase to decrease the required bandwidth and therefore improve the spectral efficiency. Bandwidth B to decrease the required. Moreover, we may decrease the to such
2、 a low level that the signal power is under the noise power level, this is called Spread Spectrum Modulation. The principle of spread spectrum: In the sender side, the information is modulated into digital signal, then the PN code is used to modulate the digital signal so that the spectrum of the si
3、gnal is spreaded, finally the spreaded signal is sent out. In the receiver side, we use the same PN code to de-spread the signal, and recover the original information. Above all, we can find out for a general Spread Spectrum Communication System, there needs three times of modulation and correspondi
4、ng demodulation. They are information modulation. Spread spectrum modulation and Radio Frequency modulation.DSSS (Direct Sequence Spread Spectrum):There are different kinds of techniques about Spread Spectrum, here we mainly look at the Direct Sequence Spread Spectrum (DSSS): For DSSS, we usually us
5、e periodical pseudo sequence (PN sequence) to modulate the baseband signals, and exploit the modulated signal to control the phase of carrier wave. The following is the DSSS system, and the pseudorandom sequence generator generates the spreading sequence: The following is the spectra of desired rece
6、ived signal with interference: (a) wideband filter output and (b)correlate output after de-spreadingThe correlation of the spread spectrum code sequence: The PN code can be approximately regarded as random signal, so it shares some prosperities of noise. We choose PN code, that is because in the pro
7、cess of information transformation the larger the difference between different signals the better transformation quality. This quality can be represented in the form of autocorrelation. The quality for spreading spectrum of DSSS: Anti-interference Multiple addressCDMA (Code Division Multiple Address
8、): Because of the advantages of DSSS, such as the anti-jamming capability, low probability of interception, multiple access capability and so on, it has been widely applied for secure communications and mobile communications known as Code Division Multiple Access System. Code Division Multiple Addre
9、ss System can be realized by taking advantage of the orthognality of the PN sequence. Basic Requirement In this experiment, the following items need to be done: Write a program to generate the m sequence with 0 0 0 0 1 0 1 0 1 0 0 0 1 0 1 Draw the autocorrelation of the generated m-sequence Build up
10、 a simulation system of the given figure with the data rate 1bit/s, spreading gain 64 and the carrier frequency 128Hz. Experiment Procedure Write a program to generate the m sequence with The code for generating the m-sequence is as following: function mseq = mseries (coefficients); len = length (co
11、efficients) ; L = 2len - 1 ; %the length of the shift register registers =zeros(1,len-1),1 ; %the initial content of the shift register mseq (1)= registers (len) ; for i = 2 :L newregisters(1)= mod(sum(coefficients.*registers),2); for j=2:len, newregisters(j)=registers(j-1); end; registers = newregi
12、sters; mseq(i) = registers(len); end we save this piece of code as a function, then type stem(mseries(0 0 0 0 1 0 1 0 1 0 0 0 1 0 1) and we get the follwoing graph: Draw the autocorrelation of the generated m-sequence The following code is used to manipulate the correlation of two signals: function
13、r=coorr(seq1,seq2) if nargin=1 seq2=seq1; end N=length(seq1); for k=-N+1:-1 seq2_shift=seq2(k+N+1:N) seq2(1:k+N); r(N+k)=seq1*seq2_shift; end for k=0:N-1 seq2_shift=seq2(k+1:N) seq2(1:k); r(N+k)=seq1*seq2_shift; end Input the following code, then we can get the following graph: mseq= 0 0 0 0 1 0 1 0
14、 1 0 0 0 1 0 1; ind1=find(mseq=0); mseq(ind1)=-1; r1=coorr(mseq, mseq); N=length(mseq); axis =-N+1:N-1; plot(axis,r1) xlabel( k); ylabel( R(k); title( The autocorrelation of M-sequence ); Build up a simulation system of the given figure with the data rate 1bit/s, spreading gain 64 and the carrier fr
15、equency 128Hz.1. Generation of the original data: % SYSTEM REQUIRMENTS %data bit rate : 1 bit/s %carrier frequency: 128Hz %spread gain: 64 clc; clear all; close all; % First of all we need to generate the original data % by using Randn() function, standard normal distribution % and we set the origin
16、al data to be of 1s and -1s data_length=20; % sdefine the length of each users original data numOfUser = 4; % specify the number of the users sumLength = numOfUser*data_length; % the overall data length is 20*4 d = zeros(numOfUser,data_length); % 4*20 double matrix of all zeros randn(state,sum(100*c
17、lock); % make the seed of the function different each time for i=1:numOfUser d(i,:) = sign(randn(1,data_length); % 1*20 double matrix end dd = d(1,:);d(2,:);d(3,:);d(4,:); % 20*4 double matrix % Generate the orthorgnal 4 ordered Walsh code % Where 4 represent the number of users walshCode = hadamard
18、(numOfUser); % call the function hadamard(), walshCode is 4*4 matrix walshCode = walshCode/2; % normalisition w is s = dd*walshCode; %Coding: dd is of the size 20*4; walshCode is of the size 4*4 %s is of the size 20*4 cdmData = reshape(s,1,4*data_length); % cdmDatas size:1*80 for i=1:sumLength % set
19、 sampling frequency to be % fs = 128*8=1024Hz i.e.8sample/T data(1+(i-1)*1024):i*1024)=cdmData(i); % fs/f=1024 samples end % END of step 1.We have generated the original data sequence d of length % equals to 20*numOfUser*1024=819202. Generate the PN sequence g = 41889; % G = 1010001110100001 b14=b13
20、*b9*b8*b7*b5*b0 state =16385 ;% state=100000000000001 140after the first 1 PNlength=64*sumLength; %PN frequency is 64Hz, 64Hz/1Hz = 64. x_code=sign(mgen(g,state,PNlength)-0.5); %turn -1s & 1s for i=1:PNlength PNcode(1+(i-1)*16):i*16)=x_code(i); %16 samples per PNcode end % then we generate a sequenc
21、e of PNcode with the length 64*20*16 = % length(d)3. Spectrum Spreading fmodSig=data.*PNcode; %PNcode: frequency spreading code % fmodSig: frequency modulated signal by PNcode4. BPSK Modulation % carrier frequency: 128Hz cosin signal for i=1:length(data)/8 AI=1; % the amplitude of the carrier signal
22、 dt=2/3; n=0:dt/7:dt; %8 samples per Period of Carrier cI=AI*cos(2*pi*n*1.5); modSig(1+(i-1)*8):i*8)=fmodSig(1+(i-1)*8):i*8).*cI; end % Adding Noise % AWGN channel adding noise to the signal EsNodB = 0:8; sigma = zeros(1,length(EsNodB); for k=1:length(EsNodB) sigma(k) = sqrt( 10.(-EsNodB(k)/10)/2 );
23、 modSigWithNoise = modSig + sigma(k)*randn(1,length(modSig); end % EsNodB = 4; % sigma = sqrt( 10.(-EsNodB/10)/2 ); % modSigWithNoise = modSig + sigma*randn(1,length(modSig);5. BPSK demodulation AI=1; dt=2/3; n=0:dt/7:dt; %8 samples per Carrier Period cI=AI*cos(2*pi*n*1.5); for i=1:length(data)/8 de
24、modSig(1+(i-1)*8):i*8)=modSigWithNoise(1+(i-1)*8):i*8).*cI; end6. Frequency demodulation fdemodSig=demodSig.*PNcode;7. Received data RecovData=zeros(1,length(fdemodSig); value=zeros(1,length(fdemodSig)/1024); avg=zeros(1,length(fdemodSig)/1024); for j=1:(length(fdemodSig)/1024) avg(j) = 2*sum(fdemod
25、Sig(1+(j-1)*1024: j*1024)/1024; %*! integral of sin or cos function need a % multiplication of 2 value(j) = round(avg(j); RecovData(1+(j-1)*1024:j*1024)=value(j); End8. Make judgments. %.Demultiplexing v = reshape(value,4,20); % 4*20 rd = v*walshCode; % 20*4 matrix rd = rd; % 4*20 matrix9. Calculate
26、 the error rate of the whole process error = sum(sum(abs(v-s)/2); errorRate = 100*error/sumLength; disp(The error rate of this process is: ); disp(errorRate);10. Demultiplexing %.Demultiplexing v = reshape(value,4,20); % 4*20 rd = v*walshCode; % 20*4 matrix rd = rd; % 4*20 matrix Conclusion Through
27、the simulation of system with and without noise, with and without spreading spectrum, we can see that if the Es/No is equal, the bit error rate of the system with spreading spectrum is better than the one without spreading spectrum. DSSS has high quality of anti-interference. The DS signal has very wide spectrum, a small fraction of fading could not influence much for the whole signal. DSSS has good ability of multiple addressing.
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1