F2=3800Hz时,
实验代码如下: Ts=1/4000; dt=0.0001;
t1=-0.006:dt:0.006; ft=cos(2*pi*3800*t1); subplot(221); plot(t1,ft),grid on;
axis([-0.006 0.006 -1.6 1.6]); xlabel('Time(sec)'),ylabel('f(t)') title('余弦信号波形');N=5000; k=-N:N;
W=2*pi*k/((2*N+1)*dt); Fw=dt*ft*exp(-j*t1'*W); subplot(222); plot(W,abs(Fw)); grid on;
axis([-20000 20000 0 0.006]); xlabel('\\omega'),ylabel('F(w)'); title('余弦信号的频谱'); t2=-0.006:Ts:0.006; fst=cos(2.*pi.*100*t2);
6
subplot(223)
plot(t1,ft,':'),hold on stem(t2,fst),grid on
axis([-0.006 0.006 -1.5 1.5])
xlabel('Time (sec)'),ylabel('fs(t)') title('抽样后的信号'),hold off Fsw=Ts*fst*exp(-j*t2'*W); subplot(224)
plot(W,abs(Fsw)),grid on axis([-20000 20000 0 0.006]) xlabel('\\omega'),ylabel('Fsw') title('抽样信号的频谱')
(六) 结合抽样定理,利用MATLAB编程实现Sa(t)信号经过冲激脉冲抽样后得到的抽样信号fs?t?及其频谱[建议:冲激脉冲的周期分别取4*pi/3 s、pi s、2*pi/3 s三种情况对比],并利用fs?t?构建Sa(t)信号。
周期取4*pi/3 s:
7
周期取pi s:
wm=2;
wc=1.2*wm; Ts=4*pi/3; dt=0.1; t1=-4:dt:4;
ft=sinc(t1/pi).*( heaviside (t1+10)- heaviside (t1-10)); N=500; k=-N:N;
W=2*pi*k/((2*N+1)*dt); n=-100:100; nTs=n*Ts;
fst=sinc(nTs/pi).*( heaviside (nTs+10)- heaviside (nTs-10)); subplot(221);
plot(t1,ft,':'),hold on stem(nTs,fst),grid on axis([-4 4 -1 1]);
xlabel('Time (sec)'),ylabel('fs(t)') title('Sa(t)抽样后的信号'),hold off; Fsw=Ts*fst*exp(-j*nTs'*W); subplot(222)
8
plot(W,abs(Fsw),'c'),grid on axis([-10 10 -3 10])
xlabel('\\omega'),ylabel('Fsw') title('Sa(t)抽样信号的频谱') t=-10:dt:10;
f=fst*Ts*wc/pi*sinc((wc/pi)*(ones(length(nTs),1)*t-nTs'*ones(1,length(t)))); subplot(223);
plot(t,f,'m:'),grid on; axis([-10 10 -2 9]);
xlabel('t'),ylabel('f(t)');
title('由f(nTs)信号重建得到Sa(t)信号');
周期取2*pi/3 s: 实验代码如下: wm=2;
wc=1.2*wm; Ts=2*pi/3; dt=0.1; t1=-4:dt:4;
ft=sinc(t1/pi).*( heaviside (t1+10)- heaviside (t1-10)); N=500; k=-N:N;
W=2*pi*k/((2*N+1)*dt); n=-100:100;
9
nTs=n*Ts;
fst=sinc(nTs/pi).*( heaviside (nTs+10)- heaviside (nTs-10)); subplot(221);
plot(t1,ft,':'),hold on stem(nTs,fst),grid on axis([-4 4 -1 1]);
xlabel('Time (sec)'),ylabel('fs(t)') title('Sa(t)抽样后的信号'),hold off; Fsw=Ts*fst*exp(-j*nTs'*W); subplot(222)
plot(W,abs(Fsw),'c'),grid on axis([-10 10 -3 10])
xlabel('\\omega'),ylabel('Fsw') title('Sa(t)抽样信号的频谱') t=-10:dt:10;
f=fst*Ts*wc/pi*sinc((wc/pi)*(ones(length(nTs),1)*t-nTs'*ones(1,length(t)))); subplot(223);
plot(t,f,'m:'),grid on; axis([-10 10 -2 9]);
xlabel('t'),ylabel('f(t)');
title('由f(nTs)信号重建得到Sa(t)信号');
10
四、实验结论和讨论
信号的时域与频域呈离散与周期的对应关系。最低的抽样频率应该为2f,只要抽样间
隔不大于1/2t,时域中的波形就不会发生混叠。
五、实验思考
要时刻考虑使用的函数的参数列表的问题,这次试验一开始出现的问题就是参数不匹
配,本来应该输入字符串,我却输入了表达式,导致后来没办法画出函数图像。还有就是要选取适当的观察范围,有时候坐标长度选得不合适看不出结果。
11