无线2Word文档格式.docx
《无线2Word文档格式.docx》由会员分享,可在线阅读,更多相关《无线2Word文档格式.docx(9页珍藏版)》请在冰豆网上搜索。
STEPSANDRESULTSOFTHEEXPERIMENTS
1.Generateanmsequence:
2.Calculatetheautocorrelationsequenceofit:
3.Thenwedefineainputsignalandmultiplythemsequencewithit:
4.Afterthemultiplicationofmsequenceandmodulationwithoutnoise:
5.WeaddtheAddedGaussianWhiteNoiseandgetthesignalasbelow:
6.Thenwedothedemodulationpart.
7.AfterfiltertheAGWNanddoingsamplingjudgment,wegettheinputsignalagain:
CONCLUSION
Fromthislab,wehavelearnedtheMATLABlanguageofrealizingdirectsequencespreadspectrum,whichiswidelyusedinmoderncommunicationandmilitarycommunication.Besides,wehavegotfamiliarwithmuchrelativemathematicalknowledge,suchascorrelationandorthogonality,bythislab.Inthisexperience,wemodeledadirectsequencespreadprocedure,andthatgiveusadeeperunderstandingtothislecture.
APPENDIX
main:
connections='
1010001110100001'
;
%n阶反馈寄存器系数
c=bin2dec(connections);
[fa]=smodulate(c,8,1,64,128);
figure();
plot(f);
axis([0256-22]);
xlabel('
ModulatedSignal'
);
plot(a);
axis([0128-22]);
OriginalSignal'
g=noise(f,8);
plot(g);
ModulatedSignalwithNoise'
x=sdemodulate(f,c,8,1,64,128);
x=x*2-1;
comp(a,x);
plot(x);
DemodulatedSignal'
chip:
function[out,Tc]=chip(ms,T)
Tc=1/64;
N_s=8;
N=length(ms);
dt=Tc/N_s;
t=0:
dt:
N*Tc-dt;
gt=ones(1,N_s);
mt=sigexpand(ms,N_s);
mt=conv(mt,gt);
out=mt(1:
N*N_s);
comp:
function[out]=comp(in1,in2);
l1=length(in1);
l2=length(in2);
ifl1~=l2
out=-1;
else
d=0;
l=l1;
fori=1:
l
c=in1(l)-in2(l);
d=d+c;
end
out=d;
ms_gen:
function[out,l]=ms_gen2(g,state,N)
lA=length(g);
iflA==1
connections=dec2bin(g)-'
0'
else
connections=g;
lB=length(connections);
regState=dec2bin(state,lB-1)-'
l=2^(lB-1)-1;
loop=min(l,N);
fork=1:
loop
period(k)=regState(lB-1);
an=rem(sum(connections(2:
end).*regState),2);
regState=[anregState(1:
lB-2)];
ifN>
l
i=fix(N/l);
j=rem(N,l);
fori1=1:
i
out(((i1-1)*l+1):
(i1*l))=period(1:
l);
end
out((i*l+1):
N)=period(1:
j);
out=period;
d=1-2*out;
l=min(l,N);
auto_corr=conv(d,d(l:
-1:
1))/l;
stem(auto_corr(l:
end));
axis([0100-22]);
Autocorrelationofmsequence'
msignal:
function[out,d]=msignal(ms,Tc)
A=1;
Sr=1;
N1=length(ms);
N=N1*Tc/N_s;
Ts=1/Tc;
fc=1;
dt=1/fc/N_s;
N*Ts-dt;
Lt=length(t);
d=sign(randn(1,N));
dd=sigexpand(d,fc*N_s*Ts);
gt=ones(1,fc*N_s*Ts);
d_NRZ=conv(dd,gt);
out=d_NRZ(1:
N1).*ms;
AGWN:
function[out]=noise(in,EsN0dB)
l=length(in);
sigma=sqrt(10.^(-EsN0dB/10)/2);
out=in+sigma*randn(1,l);
sdemodulate:
function[out]=sdemodulate(in,g,state,symRate,spreG,cf)
le=length(in);
fc=cf;
N=le/cf/N_s;
Ts=symRate;
Tc=Ts/spreG;
1*Ts-dt;
Lt=length(t)
N1=N/Tc;
ms=ms_gen2(g,state,N1);
msd=1-ms*2;
msd=sigexpand(msd,fc*Tc*N_s);
gc=ones(1,fc*Tc*N_s);
md=conv(msd,gc);
md=md(1:
le);
ht=A*cos(2*pi*fc*t);
in2=in.*md;
psk=reshape(in2'
(1/dt/Ts),le*dt/Ts);
psk=psk'
le*dt/Ts
s=sum(psk(i,:
).*ht);
ifs>
0
out(i)=1;
else
out(i)=0;
sigexpand:
function[out]=sigexpand(d,M)
N=length(d);
out=zeros(M,N);
out(1,:
)=d;
out=reshape(out,1,M*N);
smodulate:
function[out,d]=smodulate(g,state,symRate,spreG,cf)
N=1000;
Lt);
d_NRZ=conv(dd,gt);
d_2psk=d_NRZ(1:
Lt).*md;
out=d_2psk.*ht;