Re: Confused by FFTW output

stevenj_at_alum.mit.edu
Date: 03/15/05


Date: 15 Mar 2005 15:30:36 -0800

Tom wrote:
> I am trying to get acquainted with the latest FFTW and wrote a small
> test program to ensure correct usage by comparing a computed spectrum
> with an analytical solution. For a start, I chose a Gaussian,
> f(t)=exp(-a*t^2), whose spectrum is a purely real function, namely
> F(w)=sqrt(pi/(4a))*exp(-w^2/(4a)). However, when computing the
spectrum
> with FFTW, I get a nonvanishing imaginary part in the transform,

As others have pointed out, you have to be more careful with the
symmetry in order to get a real output.

However, you have another problem, which is perhaps more symptomatic of
your underlying misunderstanding: the FFT computes the discrete Fourier
transform (DFT), which is *not the same* as the continuous Fourier
transform.

In particular, the DFT implies periodic boundary conditions, which
means that even though you think your input is a single Gaussian, it is
actually an infinite periodic sequence thereof (with chopped-off
tails), which changes its transform. (This periodicity is also why you
got the symmetry wrong.)

Steven



Relevant Pages