As a test, I am trying to compute the real component of the Fourier transform of a cosine function:
f(t) = cos(2pix)

I expect a result like this:
F(w) = (1/2) * [delta(w+1)+delta(w-1)]
Re(F(w)) = (1/2) * [delta(w+1)+delta(w-1)]

When I do the transform, the output histogram has a range on the x-axis from 0 to 100. The shape of the output looks correct: all bins have zero entries except for two bins with content = 0.5. But the x-axis should range from -1 to +1, not 0 to 100.

What is the prescription for rescaling the x-axis of the “real” transformed histogram? I see a prescription in the tutorial for “magnitude” and “phase” transformed histograms, but not for “real” or “imaginary” transformed histograms: root.cern.ch/root/html/tutorials/fft/FFT.C.html

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.