A octave/MATLAB script to show how Nyquist's formula: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
Nyquist showed that if the function <math>x(t)</math> was band limited to less than <math>1 \over {2T}</math> Hz, then it could be represented by <math>x(t) = \sum_{k=- \infty}^\infty x(kT)sinc({t-kT} \over T)</math>. This octave script checks this for finite values of <math>M</math> in the sum, <math>x(t) = \sum_{k=- M}^M x(kT)sinc({t-kT}\over T)</math>. |
Nyquist showed that if the function <math>x(t)</math> was band limited to less than <math>1 \over {2T}</math> Hz, then it could be represented by <math>x(t) = \sum_{k=- \infty}^\infty x(kT)sinc({t-kT} \over {T})</math>. This octave script checks this for finite values of <math>M</math> in the sum, <math>x(t) = \sum_{k=- M}^M x(kT)sinc({t-kT}\over T)</math>. |
||
<nowiki>% This is a script to check Nyquist's formula giving a low pass |
<nowiki>% This is a script to check Nyquist's formula giving a low pass |
||
% function as a function of its sample points, x(kT). |
% function as a function of its sample points, x(kT). |
Revision as of 21:32, 2 November 2016
Nyquist showed that if the function was band limited to less than Hz, then it could be represented by . This octave script checks this for finite values of in the sum, .
% This is a script to check Nyquist's formula giving a low pass % function as a function of its sample points, x(kT). % Note that the approximation is pretty good for -M*T<t<M*T. M=100; % Number of terms T=1e-4; Tf=.02; function x0 = x(t0) x0=sin(2*pi*180*t0)+cos(2*pi*50*t0); endfunction t=-Tf:T/1000:Tf; x1=zeros(size(t)); for k=-M:M x1 = x1 + x(k*T).*sinc((t-k*T)/T); end plot(t,x1,t,x(t)) title(strcat('Approximation: M*T =',num2str(M*T))) legend('seres','actual')