% % Written by: % -- % John L. Weatherwax 2008-11-24 % % email: wax@alum.mit.edu % % Please send comments and especially bug reports to the % above email address. % %----- % for a sampling of T=1.0: % T = 1.0; t = -6:+T:+6; x = exp( - abs(t) ); N = 500; dftx1 = T*fft( x, N ); domega = (2*pi)/(T*N); omega = 0 : domega : (2*pi - domega); % find the value of omega_k that is closest to pi/2 [mv,mi] = min(abs(omega - pi/2)); fprintf( 'mi = %10d (zero based indexing)\n', mi-1 ); % what does our FFT give us at this index: dftx1(mi) clear; % for a sampling of T=0.2: % T = 0.2; t = -6:+T:+6; x = exp( - abs(t) ); N = 500; dftx2 = T*fft( x, N ); domega = (2*pi)/(T*N); omega = 0 : domega : (2*pi/T - domega); % find the value of omega_k that is closest to pi/2 [mv,mi] = min(abs(omega - pi/2)); fprintf( 'mi = %10d (zero based indexing)\n', mi-1 ); % what does our FFT give us at this index: dftx2(mi) % the exact result: % 2/(1+(pi/2)^2)