# Where is the Nyquist frequency in an FFT spectrum?

I've been working with even length audio for a while, so I've had no problem finding the Nyquist frequency in the FFT spectrum, as it's shape is:

$$(\text{dc_component}, f_1, f_2, ..., f_{N/2-1}, f_\text{NYQUIS}, -f_{N/2-1}, -f_{N/2-1}, ..., -f_1)$$

However, an odd number of elements doesn't fit this. What's the layout for odd FFT spectrums?

• Continuing here because of chat limitation. It's (N-1)/2 not N/2-1 since N is odd. $X[k]$ is more conventional than $f_k$, using $i$ is a bad convention since $i$ (or $j$ for Engineers) is the symbol for $\sqrt{-1}$. $n$ is the usual iterator in the signal domain and $k$ for bins. Matlab throws things off by using 1 based indexing as 0 based is natural for the DFT. In my articles I use $Z_k$. Subscripting is mathematical notation for sequences. Using brackets is an alternative notation conventionally used in DSP. Using parentheses implies a continuous function. Jul 12, 2020 at 13:16
• You're welcome. You shouldn't go any farther until you get a grip on complex numbers. One based indexing makes sense in traditional matrix math as that is how it is traditionally denoted. Original BASICs were also one based in arrays. Python is a dialect of BASIC (IMO) and a very good choice. Jul 12, 2020 at 13:27

You clearly haven't digested the information from the other answers I gave you. With an odd number of points, the Nyquist frequency lies cleanly between two bins and does not occur at a bin.

For conceptual purposes, an odd number of points let you set zero at the center flanked by the same number of points on each side. Likewise, the DFT can be centered at DC flanked by the same number of bins on each side, positive one way, negative the other.

• For conceptual purposes, an odd number of points let you set zero at the center flanked by the same number of points on each side. Likewise, the DFT can be centered at DC flanked by the same number of bins on each side, positive one way, negative the other. what about the nyquis bin? do you delete it? For my analysis I'm applying a Hilbert transform, which flattens the negative frequencies (by zeroing the top half of the spectrum. If the nyquis frequency is split between 2 bins, I have no idea how you'd do this transform. Jul 12, 2020 at 12:26
• Absolutely a prerequisite. Start here: dsprelated.com/showarticle/754.php Answer to first comment: There is no Nyquist bin. A bin index $k$ (off by one in Matlab) corresponds to the number of cycles in the frame. The frequency units of a DFT are cycles per frame, with bin values representing tones of whole frequencies. Jul 12, 2020 at 12:33
• So the layout is $(\text{dc_component}, f_1, f_2, ..., f_{N/2-1}, -f_{N/2-1}, -f_{N/2-1}, ..., -f_1)$? Jul 12, 2020 at 12:36
Lets assume the sampling frequency is 4 and the FFT size is 8. The FFT frequency vector is then $$[0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5]$$ subtracting $$f_s=4$$ from the frequencies greater than $$f_s/2$$ gives the following: $$[0, 0.5, 1, 1.5, 2, -1.5, -1, -0.5]$$
We can do the exact same thing for an odd length. To keep the math simple, the sampling frequency is 3.5 and the FFT size is 7. The frequencies of the FFT are then: $$[0, 0.5, 1, 1.5, 2, 2.5, 3$$ subtracting $$f_s=3.5$$ from the frequencies greater than $$f_s/2$$ gives the following: $$[0, 0.5, 1, 1.5, -1.5, -1, -0.5]$$