通信原理实验报告三实验内容:用matlab编写2ASK,2PSK程序实验一:2ASK程序A=1;fc=2;N_sample=8;N=500;Ts=1;dt=Ts/fc/N_sample;t=0:dt:N.*Ts-dt;Lt=length(t);%产生二进制信源d=sign(randn(1,N));dd=sigexpand((d+1)/2,fc.*N_sample);gt=ones(1,fc.*N_sample);%NRZ波形figure(1);subplot(2,1,1);d_NRZ=conv(dd,gt);plot(t,d_NRZ(1:length(t)));axis([01001.2]);ylabel('输入信号')%2ASK信号ht=A.*cos(2.*pi.*fc.*t);s_ask=d_NRZ(1:Lt).*ht;subplot(2,1,2);%画图plot(t,s_ask);axis([010-1.21.2]);ylabel('2ASK');%常用到的子函数sigexpand.mfunction[out]=sigexpand(d,M);%将输入序列扩展成间隔为N-1个0的序列N=length(d);out=zeros(M,N);out(1,:)=d;out=reshape(out,1,M.*N);实验二:2PSK程序A=1;fc=2;N_sample=8;N=500;Ts=1;dt=Ts/fc/N_sample;t=0:dt:N.*Ts-dt;Lt=length(t);%产生二进制信源d=sign(randn(1,N));dd=sigexpand((d+1)/2,fc.*N_sample);gt=ones(1,fc.*N_sample);%NRZ波形figure(1);subplot(2,1,1);d_NRZ=conv(dd,gt);dd_NRZ=2*d_NRZ-1;plot(t,d_NRZ(1:Lt)*2-1);axis([01001.2]);ylabel('输入信号')%2PSK信号ht=A.*sin(2.*pi.*fc.*t);s_psk=dd_NRZ(1:Lt).*ht;subplot(2,1,2);%画图plot(t,s_psk);axis([010-1.21.2]);ylabel('2PSK');