# Why does my FFT result seem reversed?

Disclaimer: I’m computer scientist, no math expert

I’m computing a frequency spectrum by applying an FFT on 10000 real numbers acquired at 10kHz. The FFT produce 10000 complex numbers. The frequency spectrum is obtained by computing the magnitude of the complex numbers and yields a symmetric array. I’m programming in Go if it matters.

I was expecting that the magnitude of 0Hz would be stored at index 5000, and 1kHz at index 6000 and 4000. But magnitude of 0Hz is stored at index 0, and 1kHz at index 1000 and 9000.

Is this normal, or is this a feature of the library I use ?

• I'm not an expert on FFT implementations. However, usually FFT algorithms output the frequency bins in the following order [0, fs/N, 2*fs/N,...fs/2, -fs/N, -2*fs/N,... -fs/2]. In Matlab we usually use the fftShift function to shift the fft so that the most negative frequency is in the leftmost position.
– Ben
Jan 29, 2021 at 14:26
• @Ben it is thus a property of the algorithm. Thank you. When I compute the magnitude with sqrt(re*re+im*im), do I have to also divide the result by N or N/2 ? Jan 29, 2021 at 14:29
• You divide it by N/2.
– Ben
Jan 29, 2021 at 14:32
• @Ben that depends on the normalization that the individual implementation does and can't be generally answered. But, N/2 sounds wrong in any case. Jan 29, 2021 at 16:40
• @chmike. FFT algorithms typically output the frequency bins in the following order [0, fs/N, 2*fs/N, 3*fs/N, ..., (N/2-1)*fs/N, (N/2)*fs/N, -(N/2-1)*fs/N, ..., -3*fs/N, -2*fs/N, -fs/N] Jan 29, 2021 at 17:50