this is a commonly confused point. There are 4 thing that we associate Mr. Fourier's name with: Fourier transform, Fourier series, Discrete Time Fourier Transform, and Discrete Fourier transform. The FFT is a special case of the Discrete Fourier Transform. This is NOT the same thing as a Fourier transform. You are comparing apples and oranges. Matlab cannot do a Fourier transform, only a discrete fourier transform. If you really want a Fourier transform, use a computer algebra system like Maple or Mathematica.
Daniel
"adansteel " <adansteel@libero.it> wrote in message <lqqi2i$q6q$1@newscl01ah.mathworks.com>...
> 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');
Daniel
"adansteel " <adansteel@libero.it> wrote in message <lqqi2i$q6q$1@newscl01ah.mathworks.com>...
> 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');