figure(2); % Open a new figure window to see the demo of signal reconstruction
stem(nTs,xs,'.'); xlabel('Time index n'); grid on;hold on for i = 1:L m = (L-1)/2+1-i;
xa = Ts*(wc)*xs(i)*sinc((wc)*(t+m*Ts)/pi)/pi; plot(t,xa,'b:');axis([-2,2,-0.5,2.5]); hold on pause
xr = xr+xa; % Interpolation end
plot(t,xr,'r'); axis([-2,2,-0.5,2.5]); hold on figure(1); subplot(223)
plot(t,xr,'r');axis([-2,2,-0.5,2.5]); xlabel('Time t');grid on title('Reconstructed signal xr(t)'); % Compute the error between the reconstructed signal and the original signal
error = abs(xr-x); subplot(2,2,4) plot(t,error);grid on
title('Error');xlabel('Time t') 程序运行结果图: 当ws/wm= 1时
当ws/wm= 2时
当ws/wm= 3时
分析:当ws/wm<2时重建的信号图形出现重叠现象,当 ws/wm>=2时才能无失真的重建原来的图形。即满足抽样定理 ws/wm的值必须大于或等于2重建原图形。