An octave/MATLAB script to show the Fourier series of a string of impulse functions: Difference between revisions
Jump to navigation
Jump to search
(Created page with " <nowiki> % This is a script to see if the Fourier series with unity coefficients is % really a series of impulse functions. M=100; % Number of terms T=1e-3; % the period of...") |
No edit summary |
||
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
This checks this identity. <math>\sum_{k=-\infty}^\infty \delta(t-kT) = \sum_{k=-\infty}^\infty e^{-j2\pi kt/T}</math> |
|||
<nowiki> |
<nowiki> |
||
% This is a script to see if the Fourier series with unity coefficients is |
% This is a script to see if the Fourier series with unity coefficients is |
||
Line 9: | Line 10: | ||
for k=-M:M |
for k=-M:M |
||
v = 1; |
v = 1; |
||
f = f+v*exp( |
f = f +v*exp(j*2*pi*k*t/T); |
||
end |
end |
||
plot(t,f) |
plot(t,f) |
||
title(strcat('\Sigma_{k=-\infty}^\infty \delta(t-kT) \approx \Sigma_{k=-M}^M e^{-j2\pi nt/T}' |
|||
,'(M = ',num2str(2*M),' Terms, and T =',num2str(T),')')) |
|||
%title(strcat('Fourier Series of a Sum ofImpulse Functions with ',num2str(2*M),' Terms')) |
|||
xlabel('Time (S)') |
|||
</nowiki> |
</nowiki> |
||
[[File:Sampling Function.png|800px]] |
Latest revision as of 16:48, 2 November 2016
This checks this identity.
% This is a script to see if the Fourier series with unity coefficients is % really a series of impulse functions. M=100; % Number of terms T=1e-3; % the period of the sampling function is 1 mS. t=0:T/1000:10*T; f=zeros(size(t)); for k=-M:M v = 1; f = f +v*exp(j*2*pi*k*t/T); end plot(t,f) title(strcat('\Sigma_{k=-\infty}^\infty \delta(t-kT) \approx \Sigma_{k=-M}^M e^{-j2\pi nt/T}' ,'(M = ',num2str(2*M),' Terms, and T =',num2str(T),')')) %title(strcat('Fourier Series of a Sum ofImpulse Functions with ',num2str(2*M),' Terms')) xlabel('Time (S)')