Rescaling the x-axis of FFT transformed histogram

The answer can be found in the fftw documentation:
fftw.org/doc/The-1d-Discrete … _0029.html

Here is what I believe the answer is:

  • Say your input histogram has a sampling frequency of “f”, where f = 1 / (input histogram bin width)
  • Say your output histogram has “nFFT” bins
  • Then for k <= (nFFT / 2), the kth bin of your output histogram corresponds to the frequency k * f / nFFT
  • If you only want to plot positive frequencies, then you’re done. Just plot the first nFFT / 2 bins and ignore the following bins of the FFT output.
  • If you do want to plot negative frequencies, the values corresponding to the negative frequencies are stored in backwards order in the second half of the output [k > (nFFT / 2)].

As an aside: in addition to my question on this topic, I noticed a few very similar questions on this forum that had not been answered. Here are just two examples:

Is this feature simply no longer supported? That would be a shame.

Best,
Edmund

1 Like