您好,欢迎访问三七文档
当前位置:首页 > 电子/通信 > 综合/其它 > 2ASK调制解调系统MATLAB源程序
2ASK调制解调系统MATLAB源程序%产生数字基带信号figure('Name','数字信号调制过程中波形及其频谱','NumberTitle','off')fc=1000;fs=4000;ts=1/fs;snr=10;v=100;N=40;m=40;bit=randint(1,m);bits=[];sig=[];fori=1:length(bit)%%length(m)表示信号m的长度ifbit(i)==0bits=zeros(1,N);elsebits=ones(1,N);endsig=[sig,bits];end[Pxx,Pxxc,f]=pmtm(sig,3.5,1024,fs,0.99);SIG=dspdata.psd(Pxx,'Fs',fs);t=ts:ts:ts*m*N;s=cos(2*pi*fc*t);%载波信号[Pxx,Pxxc,f]=pmtm(s,3.5,1024,fs,0.99);S=dspdata.psd(Pxx,'Fs',fs);s_ask=sig.*s;%调制信号[Pxx,Pxxc,f]=pmtm(s_ask,3.5,1024,fs,0.99);S_ASK=dspdata.psd(Pxx,'Fs',fs);subplot(321);plot(sig);title('数字基带信号');axis([0800-0.51.5]);gridon;subplot(322);plot(SIG);title('数字基带信号功率谱');subplot(325);plot(t,s);title('载波信号波形');axis([00.4-1.51.5]);subplot(326);plot(S);title('载波信号功率谱');subplot(323);plot(t,s_ask);title('调制后信号波形');axis([00.4-1.51.5]);subplot(324);plot(S_ASK);title('调制后信号功率谱');%添加噪声figure('Name','噪声及带通滤波','NumberTitle','off')y=awgn(s_ask,snr);[Pxx,Pxxc,f]=pmtm(y,3.5,1024,fs,0.99);Y=dspdata.psd(Pxx,'Fs',fs);a=[700,1300];Wp=a/(fs/2);Rp=0.1;Rs=35;Rp=0.1;Rs=35;[b,a]=ellip(4,Rp,Rs,Wp);q=filter(b,a,y);[Pxx,Pxxc,f]=pmtm(q,3.5,1024,fs,0.99);Q=dspdata.psd(Pxx,'Fs',fs);subplot(221);plot(t,y);title('添加噪声后信号波形')subplot(222);plot(Y);title('添加噪声后信号')subplot(223);plot(t,q);title('带通滤波信号')subplot(224);plot(Q);title('带通滤波信号')%低通滤波及抽样判决figure('Name','低通滤波及抽样判决','NumberTitle','off')ask=q.*s;Wp=300/(fs/2);%Ws=110/(fs/2);Rp=0.1;Rs=35;[b,a]=ellip(4,Rp,Rs,Wp);ss_ask=filter(b,a,ask);[Pxx,Pxxc,f]=pmtm(ss_ask,3.5,1024,fs,0.99);SS_ASK=dspdata.psd(Pxx,'Fs',fs);subplot(221);plot(t,ss_ask);title('低通滤波信号')subplot(222);plot(SS_ASK);title('低通滤波信号功率谱')sss=[];fori=1:mifss_ask(N*(i-1)+N/2)0.5bits=ones(1,N);elsebits=zeros(1,N);endsss=[sss,bits];endsubplot(223);plot(sss);title('抽样判决信号');axis([0850-0.51.5]);gridon;[Pxx,Pxxc,f]=pmtm(sss,3.5,1024,fs,0.99);SSS=dspdata.psd(Pxx,'Fs',fs);subplot(224);plot(SSS);title('抽样判决信号功率谱')figure('Name','原信号与抽样判决信号比较图像','NumberTitle','off')sig1=sig*1.5;plot(sig1,':');title('原信号与抽样判决信号比较');axis([0850-0.52]);holdon;plot(sss);legend('原信号','判决信号');
本文标题:2ASK调制解调系统MATLAB源程序
链接地址:https://www.777doc.com/doc-7319655 .html