资源描述:
《matlab仿真ask源程序word版本.doc》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、matlab仿真ask源程序clc;clear;%输入二进制信号N=10;xn=[];x=[1011001010];t=0.0125:0.0125:N;y=cos(2*pi*100*t);fori=1:Nifx(i)==1xn(i*80-79:i*80)=ones(1,80);elsexn(i*80-79:i*80)=zeros(1,80);endendsubplot(5,2,1)plot(xn);title('原始二进制信号');axis([0800-12])%载波波形y=cos(2*pi*2*t);subplot(5,2,2)plot(y);title
2、('载波波形');axis([0800-22])%载波调制z=xn.*y;subplot(5,2,3)plot(z)title('已调信号')axis([0800-1.51.5])%对已调信号进行频谱分析ba=fft(z,512);ba=abs(ba);subplot(5,2,4)plot(ba);title('已调信号频谱')axis([-2006000150])%加入高斯噪声a=0.1;%noise系数,控制噪声功率noise=a*(2*rand(1,80*N)-1);z1=z+noise;subplot(5,2,5)plot(z1);title('加
3、入噪声后信号波形');%对加噪信号进行频谱分析ba=fft(z1,512);ba=abs(ba);subplot(5,2,6)plot(ba);title('加噪信号频谱')axis([-2006000150])%设计一个低通滤波器Wp=50/80;Ws=70/80;[n,Wn]=buttord(Wp,Ws,1,5)[b,a]=butter(n,Wn);%对加入噪声的信号进行滤波x_fir=filter(b,1,z1);%观察滤波之后的信号波形subplot(5,2,7)plot(x_fir);title('滤波之后的信号')axis([0800-1.51
4、.5])%相干解调x2=x_fir.*y;subplot(5,2,8);plot(x2);title('与相干载波相乘波形')axis([0800-0.52])%对加入噪声的信号进行滤波x3=filter(b,1,x2);subplot(5,2,9)plot(x3);title('与相干载波相乘后滤波波形')axis([0800-0.52.5])%抽样判决fori=1:Nifabs(x3(i*80-20))>=0.5;xn2(i*80-79:i*80)=ones(1,80);elsexn2(i*80-79:i*80)=zeros(1,80);endends
5、ubplot(5,2,10);plot(xn2);title('恢复波形')axis([0800-12])