资源描述:
《dscdma仿真源程序》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、%main_DSCDMA.m%这个仿真程序用于实现DS-CDMA通信系统仿真%%+++++++++++++++++++++++准备咅盼+++++++++++++++++++++++++++clearall;sr=256000.0;%符号速率ml=2;%调制阶数br=sr*ml;%比特速率nd=100;%符号数SNR二5:1:10;%Eb/No%+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++%+++++++++++++++++++++滤波器初值设定++++++++
2、+++++++++++++++irfn=21;%滤波器阶数IPOINT=&%过采样倍数alfs=0.5;%滚降因子[xh]=hrollfcoef(irfn,IPOINT,sr,alfs,1);[xh2]=hrollfcoef(irfn,IPOINT,sr,alfs,0);%+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++%++++++++++++++++++++++++jj^弓马设定+++++++++++++++++++user=1;%用户数seq=1;%l:m序
3、列2:Gold序歹ij3:正交Gold序列stage=3;%序列阶数ptapl=[13];%第一个线性移位寄存器的系数ptap2=[23];%第二个线性移位寄存器的系数regil=[111];%第一个线性移位寄存器的初始化regi2=[111];%第二个线性移位寄存器的初始化%+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++disp('start');%+++++++++++++++++扩频码的产生+++++++++++++++++forebn0=-5:l:10s
4、witchseqcase1%m序列code=mseq(stage,ptap1,regi1,user);case2%Gold序列m1=mseq(stage,ptap1,regil);%正交Gold序列m2=mseq(stage,ptap2,regi2);code=goldseq(m1,m2,user);case3m1=mseq(stage,ptap1,regi1);m2=mseq(stage,ptap2,regi2);code=[goldseq(ml,m2,user),zeros(user,1)];endcode=code*2-1;clen=
5、length(code);%+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++%+++++++++++++++++++++f右+++++++++++++++++++++++rfade=0;%瑞利衰减0:不考虑1:考虑itau=[0,8];%延时dlvl1=[0.0,40.0];%衰减电平nO=67];%用于产生衰落的波数thl=[0.0,0.0];%延迟波形的初始相位itndl=[3001,4004];%设置衰落计数nowl=2;%主径和延迟波形总数tstp=1/s
6、r/IPOINT/clen;%时间分辨率fd=160;%多普勒频移[Hz]flat=1;%平坦瑞利衰落环境itndel=nd*IPOINT*clen*30;%+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++%++++++++++++++++++++++>f^真女台++++++++++++++++++++++++nloop=1000;%仿真循环次数noe=0;nod=0;forii=l:nloop%++++++++++++++++++++++++++++++++++
7、+++++++++++++++++++++++++++++%++++++++++++++++++++++++发射机++++++++++++++++++++++++++++data=rand(user,nd*ml)>0.5;[ich,qch]=qpskmod(data,user,nd,ml);%QPSK调制[ich1,qch1]=spread(ich,qch,code);%扩频[ich2,qch2]=compoversamp2(ich1,qchlJPOINT);%过采样[ich3,qch3]=compconv2(ich2,qch2,xh);%
8、滤波ifuser==1ich4=ich3;qch4=qch3;elseich4HSum(ich3)_qch4uSum(qch3)八end%++++++++++++++++++++