1、实验十二:1.参考程序clearclcfs=40;f=ones(1,81);t=-1:1/fs:1;f1=cos(2*pi*5*t).*f;figuresubplot(2,2,1), plot(t,f),axis(-1.2,1.2,0,1.2) title(f(t)时域波形)subplot(2,2,2), plot(t,f1),axis(-1.2,1.2,-1.2,1.2)title(f1(t)时域波形)N=512;Xf=fftshift(abs(fft(f,N);Xf1=fftshift(abs(fft(f1,N);w=-N/2:(N/2-1);w=w*fs/N;subplot(2,2,3)
2、, plot(w,Xf)title(f(t)的幅度频谱)subplot(2,2,4), plot(w,Xf1)title(f1(t)的幅度频谱)2. 参考程序clearclcFs=400;Fc=40;N=400;n=0:N;t=n/Fs;xt=cos(2*pi*5*t);xct=cos(2*pi*Fc*t);%调制过程及频谱yt=xt.*xct;Xw=fftshift(abs(fft(xt,512);Yw=fftshift(abs(fft(yt,512);ww=-256:255;ww=ww*Fs/512;figuresubplot(2,1,1)plot(t,xt),title(被调信号波形)s
3、ubplot(2,1,2)plot(ww,Xw) %被调信号频谱图title(被调信号频谱)figuresubplot(2,1,1)plot(t,yt),title(已调信号波形)subplot(2,1,2)plot(ww,Yw)%已调信号频谱图title(已调信号频谱)%解调y1t=yt.*xct;figuresubplot(2,1,1)plot(t,y1t),title(解调过程中间信号波形)Y1w=fftshift(abs(fft(y1t,512);subplot(2,1,2)plot(ww,Y1w)title(解调过程中间信号频谱)%设计滤波器h=fir1(20,40/200,hamm
4、ing(21);figurefreqz(h,1),title(滤波器频率特性)%滤波y2t=filter(h,1,y1t);Y2w=fftshift(abs(fft(y2t,512);figuresubplot(2,1,1)plot(t,y2t),title(解调信号的波形)subplot(2,1,2)plot(ww,Y2w),title(解调信号的频谱)3.参考程序clearclcFs=1000;Fc=100;N=1000;n=0:N;t=n/Fs;x=sin(2*pi*2*t);y1=modulate(x,Fc,Fs,am);%调幅subplot(4,1,1)plot(t,x)xlabel(t(s)ylabel(x)title(被调信号)axis(0,1,-1,1)subplot(4,1,2)plot(t,y1) %调幅信号y2=modulate(x,Fc,Fs,fm);%调频subplot(4,1,3)plot(t,y2) %调频信号y3=modulate(x,Fc,Fs,pm);%调相subplot(4,1,4)plot(t,y3) %调相信号4