# Understanding the FFT documentation

14 ビュー (過去 30 日間)
Will Hardiman 2020 年 10 月 20 日

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 2020 年 10 月 20 日
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.

#### 8 件のコメント

Star Strider 2020 年 10 月 23 日
Well, the upper limit of the frequency is in reality not ‘2*Nyquist’ (actually 0 to ) , since the frerquency folds on itself as I described. The fft function cares not one whit about the actual frequency. It simply does the Fourier transform and lets your handle the frequency vector appropriately with respect to the time-domain signal.
Will Hardiman 2020 年 10 月 24 日
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 2020 年 10 月 24 日
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.

サインインしてコメントする。

R2019a

### Community Treasure Hunt

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

Start Hunting!

Translated by