Report forexp2Word格式文档下载.docx
《Report forexp2Word格式文档下载.docx》由会员分享,可在线阅读,更多相关《Report forexp2Word格式文档下载.docx(15页珍藏版)》请在冰豆网上搜索。
ThequalityforspreadingspectrumofDSSS:
✧Anti-interference
✧Multipleaddress
CDMA(CodeDivisionMultipleAddress):
✧BecauseoftheadvantagesofDSSS,suchastheanti-jammingcapability,lowprobabilityofinterception,multipleaccesscapabilityandsoon,ithasbeenwidelyappliedforsecurecommunicationsandmobilecommunicationsknownasCodeDivisionMultipleAccessSystem.
✧CodeDivisionMultipleAddressSystemcanberealizedbytakingadvantageoftheorthognalityofthePNsequence.
●BasicRequirement
Inthisexperiment,thefollowingitemsneedtobedone:
✧Writeaprogramtogeneratethemsequencewith
[000010101000101]
✧Drawtheautocorrelationofthegeneratedm-sequence
✧Buildupasimulationsystemofthegivenfigurewiththedatarate1bit/s,spreadinggain64andthecarrierfrequency128Hz.
●ExperimentProcedure
Ø
Thecodeforgeneratingthem-sequenceisasfollowing:
◆function[mseq]=mseries(coefficients);
◆len=length(coefficients);
◆L=2^len-1;
%thelengthoftheshiftregister
◆registers=[zeros(1,len-1),1];
◆%theinitialcontentoftheshiftregister
◆mseq
(1)=registers(len);
◆fori=2:
L
◆newregisters
(1)=mod(sum(coefficients.*registers),2);
◆forj=2:
len,
◆newregisters(j)=registers(j-1);
◆end;
◆registers=newregisters;
◆mseq(i)=registers(len);
◆end
wesavethispieceofcodeasafunction,thentypestem(mseries([000010101000101]))andwegetthefollwoinggraph:
✧Drawtheautocorrelationofthegeneratedm-sequence
Thefollowingcodeisusedtomanipulatethecorrelationoftwosignals:
functionr=coorr(seq1,seq2)
◆ifnargin==1
◆seq2==seq1;
◆N=length(seq1);
◆fork=-N+1:
-1
◆seq2_shift=[seq2(k+N+1:
N)seq2(1:
k+N)];
◆r(N+k)=seq1*seq2_shift'
;
◆fork=0:
N-1
◆seq2_shift=[seq2(k+1:
k)];
Inputthefollowingcode,thenwecangetthefollowinggraph:
◆mseq=[000010101000101];
◆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('
TheautocorrelationofM-sequence'
1.Generationoftheoriginaldata:
◆%SYSTEMREQUIRMENTS
◆%databitrate:
1bit/s
◆%carrierfrequency:
128Hz
◆%spreadgain:
64
◆clc;
clearall;
closeall;
◆%Firstofallweneedtogeneratetheoriginaldata
◆%byusingRandn()function,standardnormaldistribution
◆%andwesettheoriginaldatatobeof1'
sand-1'
s
◆data_length=20;
%sdefinethelengthofeachuser'
soriginaldata
◆numOfUser=4;
%specifythenumberoftheusers
◆sumLength=numOfUser*data_length;
%theoveralldatalengthis20*4
◆d=zeros(numOfUser,data_length);
%4*20doublematrixofallzeros
◆randn('
state'
sum(100*clock));
%maketheseedofthefunctiondifferenteachtime
◆fori=1:
numOfUser
◆d(i,:
)=sign(randn(1,data_length));
%1*20doublematrix
◆dd=[d(1,:
d(2,:
d(3,:
d(4,:
)]'
%20*4doublematrix
◆%Generatetheorthorgnal4orderedWalshcode
◆%Where4representthenumberofusers
◆walshCode=hadamard(numOfUser);
%callthefunctionhadamard(),walshCodeis4*4matrix
◆walshCode=walshCode/2;
%normalisitionwis
◆s=dd*walshCode;
%Coding:
ddisofthesize20*4;
walshCodeisofthesize4*4
◆%sisofthesize20*4
◆cdmData=reshape(s'
1,4*data_length);
%cdmData'
ssize:
1*80
sumLength%setsamplingfrequencytobe
◆%fs=128*8=1024Hzi.e.8sample/T
◆data((1+(i-1)*1024):
i*1024)=cdmData(i);
%fs/f=1024samples
◆%ENDofstep1.Wehavegeneratedtheoriginaldatasequencedoflength
◆%equalsto20*numOfUser*1024=81920
2.GeneratethePNsequence
◆g=41889;
%G=1010001110100001b14=b13*b9*b8*b7*b5*b0
◆state=16385;
%state=10000000000000114‘0'
afterthefirst'
1'
◆PNlength=64*sumLength;
%PNfrequencyis64Hz,64Hz/1Hz=64.
◆x_code=sign(mgen(g,state,PNlength)-0.5);
%turn-1'
s&
1'
s
PNlength
◆PNcode((1+(i-1)*16):
i*16)=x_code(i);
%16samplesperPNcode
◆%thenwegenerateasequenceofPNcodewiththelength64*20*16=
◆%length(d)
3.SpectrumSpreading
◆fmodSig=data.*PNcode;
%PNcode:
frequencyspreadingcode
◆%fmodSig:
frequencymodulatedsignalbyPNcode
4.BPSKModulation
◆%carrierfrequency:
128Hzcosinsignal
length(data)/8
◆AI=1;
%theamplitudeofthecarriersignal
◆dt=2/3;
◆n=0:
dt/7:
dt;
%8samplesperPeriodofCarrier
◆cI=AI*cos(2*pi*n*1.5);
◆modSig((1+(i-1)*8):
i*8)=fmodSig((1+(i-1)*8):
i*8).*cI;
◆%AddingNoise
◆%AWGNchanneladdingnoisetothesignal
◆EsNodB=0:
8;
◆sigma=zeros(1,length(EsNodB));
◆fork=1:
length(EsNodB)
◆sigma(k)=sqrt(10.^(-EsNodB(k)/10)/2);
◆modSigWithNoise=modSig+sigma(k)*randn(1,length(modSig));
◆%EsNodB=4;
◆%sigma=sqrt(10.^(-EsNodB/10)/2);
◆%modSigWithNoise=modSig+sigma*randn(1,length(modSig));
5.BPSKdemodulation
%8samplesperCarrierPeriod
◆demodSig((1+(i-1)*8):
i*8)=modSigWithNoise((1+(i-1)*8):
6.Frequencydemodulation
◆fdemodSig=demodSig.*PNcode;
7.Receiveddata
◆RecovData=zeros(1,length(fdemodSig));
◆value=zeros(1,length(fdemodSig)/1024);
◆avg=zeros(1,length(fdemodSig)/1024);
◆forj=1:
(length(fdemodSig)/1024)
◆avg(j)=2*sum(fdemodSig(1+(j-1)*1024:
j*1024))/1024;
◆%*****!
!
integralofsinorcosfunctionneeda
◆%multiplicationof2
◆value(j)=round(avg(j));
◆RecovData(1+(j-1)*1024:
j*1024)=value(j);
◆End
8.Makejudgments.
◆%.Demultiplexing
◆v=reshape(value,4,20);
%4*20
◆rd=v'
*walshCode;
%20*4matrix
◆rd=rd'
%4*20matrix
9.Calculatetheerrorrateofthewholeprocess
◆error=sum(sum(abs(v-s'
)/2));
◆errorRate=100*error/sumLength;
◆disp('
Theerrorrateofthisprocessis:
'
◆disp(errorRate);
10.Demultiplexing
●Conclusion
✧Throughthesimulationofsystemwithandwithoutnoise,withandwithoutspreadingspectrum,wecanseethatiftheEs/Noisequal,thebiterrorrateofthesystemwithspreadingspectrumisbetterthantheonewithoutspreadingspectrum.
✧DSSShashighqualityofanti-interference.
✧TheDSsignalhasverywidespectrum,asmallfractionoffadingcouldnotinfluencemuchforthewholesignal.
✧DSSShasgoodabilityofmultipleaddressing.