文档介绍:实验十二:
clear
clc
fs=40;
f=ones(1,81);
t=-1:1/fs:1;
f1=cos(2*pi*5*t).*f;
figure
subplot(2,2,1), plot(t,f),axis([-,,0,])
title('f(t)时域波形')
subplot(2,2,2), plot(t,f1),axis([-,,-,])
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), plot(w,Xf)
title('f(t)的幅度频谱')
subplot(2,2,4), plot(w,Xf1)
title('f1(t)的幅度频谱')
2. 参考程序
clear
clc
Fs=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;
figure
subplot(2,1,1)
plot(t,xt),title('被调信号波形')
subplot(2,1,2)
plot(ww,Xw) %被调信号频谱图
title('被调信号频谱')
figure
subplot(2,1,1)
plot(t,yt),title('已调信号波形')
subplot(2,1,2)
plot(ww,Yw)%已调信号频谱图
title('已调信号频谱')
%解调
y1t=yt.*xct;
figure
subplot(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,hamming(21));
figure
freqz(h,1),title('滤波器频率特性')
%滤波
y2t=filter(h,1,y1t);
Y2w=fftshift(