help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

fft of exponential function and normalization


From: ander
Subject: fft of exponential function and normalization
Date: Thu, 24 Jul 2014 14:57:48 -0700 (PDT)

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');



--
View this message in context: 
http://octave.1599824.n4.nabble.com/fft-of-exponential-function-and-normalization-tp4665736.html
Sent from the Octave - General mailing list archive at Nabble.com.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]