资源描述:
《一个直序跳频混合式扩频通信系统的仿真》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、一个直序/跳频混合式扩频通信系统的仿真%%%%%%%%%%%%%++直接序列扩频1+++++++++++++++++++++++++++++++++++++++++++clear;clc;code_length=10;fs=4960; %每个信息码元内含fs个采样点t=0:1/fs:code_length;rand('seed',0);x=sign(rand(1,code_length)-0.5); %信息码fori=1:code_length s((1+(i-1)*fs):i*fs)=x(i);e
2、nds(i*fs+1)=x(i);figure(1);plot(t,s);axis([-0.5,code_length+0.5,-1.2,1.2]);title('原始信息码');%%++生成PN码++++++++++++++++++++++++++++++++++++++++++++++++fd=[100101]; %反馈系数num_mreg=length(fd)-1; %移位寄存器的个数num_mseq=2^(num_mreg)-1; %一个m序列的码的个数init_mseq=ones(1,num_mreg);
3、%m序列发生器初始化值mseq=zeros(1,num_mseq);fori=1:num_mreg mseq(i)=init_mseq(num_mreg-i+1);endi=i+1;forj=i:num_mseq fork=1:num_mreg iffd(k+1)==1 mseq(j)=xor(mseq(j),mseq(j-k)); end endendfori=1:num_mseq mseq(i)=sign(mseq(i)-0.5);endw_mseq=mseq;fori=1:code_length-
4、1 w_mseq=[w_mseq,mseq];endfori=1:code_length*num_mseq c_mseq(((i-1)*160+1):i*160)=w_mseq(i);endc_mseq(i*160+1)=w_mseq(i);figure(2);plot(t,c_mseq);axis([0,1,-1.1,1.1]);title('一周期m序列');%%++扩频++++++++++++++++++++++++++++++++++++++++++++++++++k_code=s.*c_mseq;figure(3);plot(t,
5、k_code);axis([0,1,-1.1,1.1]);title('扩频序列');%%++跳频调制++++++++++++++++++++++++++++++++++++++++++++++++++fc0=3*fs/31;fc1=6*fs/31;fc2=9*fs/31;fc3=12*fs/31;tc=0:1/fs:159/fs;c0=2*cos(2*pi*fc0*tc);c0=[c0,2*cos(2*pi*fc3*tc)];c0=[c0,2*cos(2*pi*fc1*tc)];c0=[c0,2*cos(2*pi*fc2*tc)];c1=c0
6、;fori=1:6 c1=[c1,c0];endc1=[c1,2*cos(2*pi*fc2*tc)];c1=[c1,2*cos(2*pi*fc3*tc)];c1=[c1,2*cos(2*pi*fc1*tc)];c=c1;fori=1:code_length-1 c=[c,c1];endc(code_length*fs+1)=0;signal=k_code.*c;figure(4);plot(t,signal);axis([100/fs,400/fs,-2.1,2.1]);%title('一个信息码元的跳频调制');%%++解跳+++++++
7、+++++++++++++++++++++++++++++++++++++++++++signal_h=signal.*c;figure(5);plot(t,signal_h);axis([0,code_length,-4.1,4.1]);%%++解扩+++++++++++++++++++++++++++++++++++++++++++++++++jk_code=signal_h.*c_mseq;figure(6);plot(t,jk_code);axis([0,code_length,-4.1,4.1]);%%++低通滤波++++++++++
8、++++++++++++++++++++++++++++++++++++wn=1/1e7;b=fir1(16,wn);H=freqz(b,1,1600