Quantcast
Channel: MATLAB Central Newsreader - fft of exponential function and normalization
Viewing all articles
Browse latest Browse all 5

fft of exponential function and normalization

0
0
Dear All,

my problem is related to fft command. I am trying to compare the theoretical result of the fourier transform of exp(-2*t) with the result of fft (in the code below, ft is the exponential function, Fft is the fourier transform and Fexact is the theoretical value).

As you can see running the code, the obtained plots are not in agreement. Moreover, using the same code but with the exponential function exp(-t) everything works as a charm (with points=1000 and period=10 for instance).

I do not know if it is a normalization problem or there are other issues. Could you please help me? Thank you in advance.

Here it is the code:

N = input('points= ') ;
T = input('period= ') ;

Ts = T/N ;

t0 = 0;
ts = (t0:Ts:Ts*(N-1)) ;

ft = exp(-2*ts) ;
ft2 = exp(-ts) ;

Fft = abs(fftshift( Ts*(fft(ft,N)) )) ;
Fft2 = abs(fftshift( Ts*(fft(ft2,N)) )) ;


fs = 1/(N*Ts) ;
f = fs*linspace(-N/2,N/2-1,N) ;

w = 2*pi*f ;

Fexact = 4./(4 + w.^2) ;
Fexact2 = 1./(sqrt(1 + w.^2)) ;

subplot(2,1,1),plot(f,Fexact(1:N),'--',f,Fft(1:N),'r');

subplot(2,1,2),plot(f,Fexact2(1:N),'--',f,Fft2(1:N),'r');

Viewing all articles
Browse latest Browse all 5

Latest Images

Trending Articles





Latest Images