您好,欢迎访问三七文档
当前位置:首页 > 机械/制造/汽车 > 汽车理论 > 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('载波波形');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('加入噪声后信号波形');%对加噪信号进行频谱分析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.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);endendsubplot(5,2,10);plot(xn2);title('恢复波形')axis([0800-12])
本文标题:matlab仿真ask源程序
链接地址:https://www.777doc.com/doc-4674472 .html