# Understanding the FFT documentation

23 views (last 30 days)
Will Hardiman on 20 Oct 2020
Edited: Star Strider on 24 Oct 2020
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:
N
X(k) = sum x(n)*exp(-j*2*pi*(k-1)*(n-1)/N), 1 <= k <= N.
n=1
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.
Will Hardiman on 24 Oct 2020
Oh, I see what I have done here - I didn't properly consider the effect of the discrete sampling, and how that causes the frequency to fold. Thank you for you patience and explanations!
Star Strider on 24 Oct 2020
Edited: Star Strider on 24 Oct 2020
As always, my pleasure!
It’s definitely different from the result the Symbolic Math Toolbox would produce for a Fourier transform:
syms t w
FTsp(w) = int(1*exp(1j*w*t), t, -1, 1);
[FTspn(w),FTspd(w)]= numden(FTsp);
FTsplh(w) = diff(FTspn)/diff(FTspd); % L’Hospital
FTsp(w) = piecewise(w<0,FTsp(w), w==0,FTsplh(w), w>0,FTsp(w));
figure
fplot(abs(FTsp), [-10*pi 10*pi])
xlabel('\omega')
ylabel('|F(\omega)|')
title('Fourier Transform Of A Pulse')
grid
EDIT — (24 Oct 2020 at 16:33)
Corrected typographical error.

### Categories

Find more on Spectral Measurements in Help Center and File Exchange

R2019a

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!