Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to utilize Numpy's fft function, however when I give the function a simple Gaussian function the FFT of that Gaussian function is not a Gaussian, its close but its halved so that each half is at either end of the x axis.

I was told by my professor that this has something to do with how when Fourier transform from x to k space, the k space in FFT algorithms tend to start from N=0 to N=N (where N is the size of the data array) and the k in this case would go from k(0) to k(N/2) (so far k would be positive) and then beyond k(N/2) k is negative and would go to k(N) = 0. So if there was a plot of k vs N, the shape would be like a slanted N if that makes sense.

In which part of the FFT algorithm is responsible for FFT of Gaussian to not be Gaussian? How to I change to make it Gaussian? Is it the Bit reversing or Butterfly operation that is responsible?

share|cite|improve this question
FFT computes a discrete transform, not a continuous one... – J. M. Apr 19 '11 at 23:58
  1. Gaussians only map to Gaussians for the continuous Fourier transform. (Though the discrete Fourier transform is in some senses a reasonable approximation to the continuous transform).
  2. The discrete Fourier transfrom (which the FFT is a method to calculate) is naturally defined not on line, but a circle. The ends wrap around, and must be identified. In particular, this means that with $N$ samples, frequencies of $N-k$ and $-k$ are just different labels for the same thing. Half Gaussians at each end really is the same thing as a Gaussian centered at 0., just presented differently.
share|cite|improve this answer

I just accept this as "the way the FFT does things". I can't explain why.

But to get the shape you want, just put your FFT results through numpy.fft.fftshift

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.