资源描述:
《直接序列扩频matlab程序》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、直接序列扩频Matlab程序直接序列扩频通信可以有效地抵抗来自信道中的窄带干扰。在一个直扩通信系统中,扩频是通过伪噪声序列(PN)对发送的信息数据进行调制来实现的。在接收端,原伪噪声序列和所收信号的相关运算可将窄带干扰扩展到DS信号的整个频带,使干扰等效为幅度较低频谱较平坦的噪声;同时,将DS信号解扩,恢复原始信息数据。-Thedirectsequencespreadspectrumcorrespondencemayeffectivelyresistfromthechannelinselectiveinterference.Straigh
2、texpandsinthecommunicationssystemin,thewidefrequencyis(PN)carriesonthroughthefalsenoisesequencetothetransmissioninformationdatamodulatesrealizes.Inthereceivingend,theoriginalfalsenoisesequenceandreceivesthesignalthecorrelationoperationtobepossibletoexpandtheselectiveinter
3、ferencetotheDSsignalentirefrequencyband,causesthedisturbanceequivalentforascopelowerfrequencyspectrumsmoothernoise;Atthesametime,expandstheDSsignalsolution,restorestheprimaryinformationdata.======================function[Y]=DSSS(X,mode)%完成DSSS调制解调功能%mode=[1,2]. 1进行调制,2进行解
4、调,未指定时自动完成调制和解调两个功能。switchnargin case0 X='Thisisatest.'; Y=DSSS(X); return case1 Y1=DSSS(X,1); Y2=DSSS(Y1,2); Y=Y2; return; case2 ifmode==1%调制 D=ones(1,7); m_sequence=Msequence(D); X_lengt
5、h=length(X); ascii_value=abs(X); ascii_binary=zeros(X_length,7); %将数据转换为ASCII二进制码 forii=1:X_length ascii_binary(ii,:)=Binary(ascii_value(ii)); end subplot(2,3,1);plot(reshape(ascii_binary,1,X_length
6、*7));title('A:输入数据'); %扩频 Sp_expand=zeros(X_length,127*7); forii=1:X_length forjj=1:7 Sp_expand(ii,127*jj-126:127*jj)=xor(m_sequence,ascii_binary(ii,jj)); end end subplot(2,3,2
7、);plot(reshape(Sp_expand,1,X_length*127*7));title('B:数据扩展'); %将扩频码转换为BPSK(1,-1)序列 forii=1:X_length forjj=1:127*7 if~(Sp_expand(ii,jj)) Sp_expand(ii,jj)=-1; end end
8、 end Sp_expand_bpsk=reshape(Sp_expand,1,X_length*127*7); subplot(2,3,