收藏 分销(赏)

代码1-共3页.pdf

上传人:天**** 文档编号:4334437 上传时间:2024-09-06 格式:PDF 页数:3 大小:42.39KB 下载积分:5 金币
下载 相关 举报
代码1-共3页.pdf_第1页
第1页 / 共3页
代码1-共3页.pdf_第2页
第2页 / 共3页


点击查看更多>>
资源描述
x=12 45 63 58 69 45 12 36 54 78 11 22 99 64 58 63 41 52 67 89 113;DSSS(X)function Y=DSSS(X,mode)switch nargincase 0Y=DSSS(X);returncase 1Y1=DSSS(X,1);Y2=DSSS(Y1,2);Y=Y2;return;case 2if mode=1D=ones(1,7);m_sequence=Msequence(D);X_length=length(X);ascii_value=abs(X)ascii_binary=zeros(X_length,7);for i=1:X_length2ascii_blinary(i,:)=Binary(ascli_value(i);endsubplot(2,3,1);plot(reshape(ascii_binary,1,X_length*7);title(A:输入的数据);Sp_expand=zeros(X_length,127*7);for I=1:X_lengthfor j=1:7Sp_expand(i,127*j-126:127*j)=xor(m_sequence,ascii_binary(i,j);endendsubplot(2,3,2);plot(reshape(Sp_expand,1,X_length*127*7);title(B:数据扩展);fot I=1:X_lengthfor j=1:127*7if(Sp_expand(i,j)Sp_expand(i,j)=-1;endendendSp_expand_bpsk=reshape(Sp_expand,1,X_length*127*7);subplot(2,3,3);plot(Sp_expand_bpsk);title(C:BPSK 调制)Y=Sp_expand_bpsk;elseif mode=2D=ones(1,7);m_sequence=Msequence(D);l=length(X)/(127*7);X_length=length(X);for i=1:X_lengthif X(i)=-1X(i)=0;endendSp_expand=reshape(X,1,127*7);subplot(2,3,4);plot(X);title(D:数据传输);ascii_binary=zeros(1,7);Demodulate_binary=zeros(1,127*7);for i=1:1for j=1:7Demodulate(i,127*jj-126:127*j)=xor(m_sequence,Sp_expand(i,127*j-126:127*j);endendfor i=1:1for j=1:7ascii_binary(i,j)=Demodulate(i,127*j-126);endendsubplot(2,3,6);plot(reshape(ascii_binary,1,1*7);title(E:数据输出);A=zeros(1,1);for i=1:1A(i)=Ascii(ascii_binary(i,:);endY=char(A);elsemode=1;endreturnendfunction YY=Binary(Z1)z=zeros(1,7);z(1)=mod(Z1,2);a=floor(Z1/2);for ii=1:6z(l1+1)=mod(a,2);a=floor(a/2);If a=0break;endendYY=z;function ZZ=Ascii(Z2)l=length(Z2);A=0;For i=l:1A=Z2(i)*2(i-1)+A;endZZ=A;function Y=Msequence(X)switch nargincase 0Y=Msequence(X);returncase 1l=length(X);mp_register=X;out_sequence=zeros(1,21-1);sum_xor=0;for i=1:21-1;out_sequence(i)=mp_register(l);sum_xor=xor(mp_register(l),mp_register(1-l);for j=l:l-1mp_register(l-j+1)=mp_register(l-j);endmp_register(l)=sum_xor;if mp_register=Xbreak;endendY=out_sequence;returnend
展开阅读全文

开通  VIP会员、SVIP会员  优惠大
下载10份以上建议开通VIP会员
下载20份以上建议开通SVIP会员


开通VIP      成为共赢上传

当前位置:首页 > 包罗万象 > 大杂烩

移动网页_全站_页脚广告1

关于我们      便捷服务       自信AI       AI导航        抽奖活动

©2010-2026 宁波自信网络信息技术有限公司  版权所有

客服电话:0574-28810668  投诉电话:18658249818

gongan.png浙公网安备33021202000488号   

icp.png浙ICP备2021020529号-1  |  浙B2-20240490  

关注我们 :微信公众号    抖音    微博    LOFTER 

客服