Understanding the FFT documentation
18 views (last 30 days)
As I understand, for a signal x, the frequency spectrum X = fft(x) is two-sided - the first half of the array is frequencies 0 to FS/2 (half the sampling frequency, i.e: Nyquist limit), while the second half has negative frequencies from -FS/2 to the lowest non-zero frequency (-1/N for a signal with N points).
Meanwhile the documentation for FFT (found using "help fft" in MATLAB R2019a) says:
X(k) = sum x(n)*exp(-j*2*pi*(k-1)*(n-1)/N), 1 <= k <= N.
This aligns with my belief that X(1) contains DC offset (0 frequency), however I reckon this would mean that X(N) contains frequency N-1. It would also mean that X(N/2) contains frequency (N/2 - 1), which actually aligns with my statement at the top of the question.
Can you help me with my confusion around the equation from the documentation?
Star Strider on 20 Oct 2020
Your understanding essentially equates to my understanding of fft. It produces a ‘two-sided’ Fourier transform with the first value being the value of the d-c offset (mean of the time-domain signal). The mid-frequency is the Nyquist frequency. The second half is the flipped (not transposed) complex-conjugate of the first half. So the frequency is actually defined for the first half from 0 to the Nyquist frequency, and for the second half, from the negative Nyquist frequency to 0.
The fftshift function creates an accurate representation of this, so the frequency vector of the result goes from the -Nyquist frequency to the +Nyquist frequency.
I doubt if I clarified anything however, I likely just re-stated it.