程序:连续信号Sa(t):t=-20:0.5:20;f=sinc(t/pi);plot(t,f);xlabel('t');ylabel('x(t)');title('连续信号sa(t)=sinc(t/pi)波形');grid;Sa(t)频谱:t=-20:0.5:20;f=sinc(t/pi);N=1000;k=-N:N;w1=10;w=k*w1/N;F=f*exp(-j*t'*w)*0.5;plot(w,F);xlabel('x');ylabel('x(w)');title('sa(t)=sinc(t/pi)信号的频谱图')Sa(t)的临界抽样及重构:wm=1;wc=wm;Ts=pi/wm;ws=2*pi/Ts;n=-100:100;nTs=n*Tsf=sinc(nTs/pi);Dt=0.005;t=-20:Dt:20;fa=f*Ts*wc/pi*sinc((wc/pi)*(ones(length(nTs),1)*t-nTs'*ones(1,length(t))));t1=-20:0.5:20;f1=sinc(t1/pi);subplot(211);stem(t1,f1);xlabel('kTs');ylabel('f(kTs)');title('sa(t)=sinc(t/pi)的临界采样信号');subplot(212);plot(t,fa);xlabel('t');ylabel('fa(t)');title('由sa(t)=sinc(t/pi)的临界采样信号重构sa(t)');grid;Sa(t)的过抽样及重构:wm=1;wc=1.1*wm;Ts=0.7*pi/wm;ws=2*pi/Ts;n=-100:100;nTs=n*Tsf=sinc(nTs/pi);Dt=0.005;t=-10:Dt:10;fa=f*Ts*wc/pi*sinc((wc/pi)*(ones(length(nTs),1)*t-nTs'*ones(1,length(t))));error=abs(fa-sinc(t/pi));t1=-10:0.5:10;f1=sinc(t1/pi);m=-20:20;N=41;Xw=abs(fft(f,N));subplot(2,2,1);plot(m,Xw);axis([-20201.1*min(Xw)1.1*max(Xw)]);xlabel('w');ylabel('|Xw|');title('抽样后频谱波形图');subplot(2,2,2);stem(t1,f1);xlabel('kTs');ylabel('f(kTs)');title('sa(t)=sinc(t/pi)的采样信号');subplot(2,2,3);plot(t,fa)xlabel('t');ylabel('fa(t)');title('由sa(t)过采样信号重构sa(t)');grid;subplot(2,2,4);plot(t,error);xlabel('t');ylabel('error(t)');title('过采样信号与原信号的误差')Sa(t)的欠抽样及重构:wm=1;wc=wm;Ts=1.5*pi/wm;ws=2*pi/Ts;n=-100:100;nTs=n*Tsf=sinc(nTs/pi);Dt=0.005;t=-10:Dt:10;fa=f*Ts*wc/pi*sinc((wc/pi)*(ones(length(nTs),1)*t-nTs'*ones(1,length(t))));error=abs(fa-sinc(t/pi));t1=-10:0.5:10;f1=sinc(t1/pi);m=-20:20;N=41;Xw=abs(fft(f,N));subplot(2,2,1);plot(m,Xw);axis([-2020min(Xw)max(Xw)]);xlabel('w');ylabel('|Xw|');title('抽样后频谱波形图');subplot(2,2,2);stem(t1,f1);xlabel('kTs');ylabel('f(kTs)');title('sa(t)=sinc(t/pi)的采样信号');subplot(2,2,3);plot(t,fa)xlabel('t');ylabel('fa(t)');title('由sa(t)欠采样信号重构sa(t)');grid;subplot(2,2,4);plot(t,error);xlabel('t');ylabel('error(t)');title('欠采样信号与原信号的误差')