I am using fft to plot the signal spectrum (convert real and imaginary components to amplitude values). If my signal is of odd length, I take $fft[0]$ as DC and use $fft[1;(N-1)/2)]$ values to get the amplitudes of the harmonics (from 1 Hz to (N-1)/2 Hz). But if my signal is of even length, the $fft$ element with index $fft[N/2]$ represents Nyquist frequency. Is it correct to use this frequency when plotting the amplitudes spectrum? Or in this case I should only consider elements in the range $fft[1; N/2-1]$ and DC at $fft[0]$?
Asked
Active
Viewed 36 times
1
-
1It depends on what you are using the results for. As demonstrated in this link: https://dsp.stackexchange.com/questions/82273/why-to-pad-zeros-at-the-middle-of-sequence-instead-at-the-end-of-the-sequence/82274#82274 the Nyquist bin when shared (for even length sequences) can be split (in complex conjugate halves) between the positive and negative spectrum in situations where we need a components at each location, since that spectral location is the same. – Dan Boschen Feb 07 '23 at 17:32
-
2What @DanBoschen said, except that in a lot of circumstances, if you have bins with significant energy in your FFT all the way up to the Nyquist frequency, then that's a strong indication that your real signal was aliased, and those frequency bins aren't valid anyway. – TimWescott Feb 08 '23 at 15:43
-
1Yes a most excellent point. What @TimWescott said, for all cases with real signals – Dan Boschen Feb 08 '23 at 17:22