MathGroup Archive 2012

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: How FFT workks? (analytical example)


InverseFourier operates on numerical data only. I will not go into mathematics of this (probably belongs to another forum), but I'll show how to do it in Mathematica.

First, lets define the functions from your example (I'll use G=2):

f[w_] := -2/(w + I)
g[t_] := InverseFourierTransform[f[w], w, t] // Evaluate;

g[t] will return: 2 I Exp[-t] Sqrt[2 pi] HeavisideTheta[t]

Now you need to choose a cutoff frequency "wCutoff" such that f[wCutoff/2] is negligible (you can always do that because Fourier transform is defined for square-integrable functions)
You also need to choose how many points of f[w] to sample (best to choose power of 2 so the FFT will work fast).

Lets choose:

wCutoff = 1000.0;
len = 4096;

Generate the frequencies at which to sample f[w]:

wList = (Range[0,len-1]/len-1/2)wCutoff;

Sample the function f[w]:

fList = f[wList];

Now for the InverseFourier (you have to exchange two halves of the fList - this is got to do with the definition of FFT). Also you have to scale the result as follows:

gList = InverseFourier[RotateLeft[fList, len/2]]wCutoff/Sqrt[2 pi len];

Now gList contains a sampled version of g[t], but at what times? The time vector is calculated as:

tList = Range[0,len-1] 2 pi/wCutoff;

Now compare g[tList] and gList and see that they match up to a certain error.

The error depends very match on the wCutoff. Large wCutoff will result in a smaller arror, but you'll need a large len to get the same time span for gList.

I hope this gives some clue, but you really need to understand the Continuous Fourier Transform and the Discrete Fourier Transform (the Fast Fourier Transform is just a fast algorithm for computing the Discrete Fourier Transform)

  • Prev by Date: Re: Can anyone see a faster way to compute quantities for a pair or large matrices?
  • Next by Date: Re: Sending an interrupt to the frontend?
  • Previous by thread: How FFT workks? (analytical example)
  • Next by thread: Re: How FFT workks? (analytical example)