?? recons.m
字號:
%================================================================
% Name: recons.m
% Signal sampling and reconstruction
% The original signal is Sa(t). Because it is a bandlimted signal
% with bandwidth wm=1 rad/s.
%================================================================
clear;
wm=1;
a=input('Type in the frequency rate ws/wm=:');
wc=1*wm;
t=-9:0.01:9;
f=sinc(wm*t/pi);
clf;
subplot(221);
plot(t,f);grid on
title('Original signal');xlabel('t');
ws=a*wm;Ts=2*pi/ws;N=fix(9/Ts);
n=-N:N;
nTs=n*Ts;
fs=sinc(wm*nTs/pi);
subplot(2,2,2)
stem(n,fs,'.');xlabel('Index n');grid on
title('Sampled version f(nTs)');
fa=zeros(1,length(t));l=length(-N:N);
for i=1:l
m=(l-1)/2+1-i;
fa=fa+Ts*(wc/pi)*fs(i)*sinc((wc/pi)*(t+m*Ts));
subplot(223);plot(t,fa,'r');
%pause(0.1)
end
xlabel('t');grid on
title('Reconstructed fa(t)');
error=abs(fa-f);
subplot(2,2,4)
plot(t,error);grid on
title('Error');xlabel('t')
%===============================================================
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -