# What determines the maximum frequency when taking the FFT?

조회 수: 35 (최근 30일)
L'O.G. 2022년 5월 2일
댓글: Star Strider 2022년 5월 2일
This is part conceptual, part MATLAB, but how do you set the maximum frequency when taking the FFT of a signal? According to the Nyquist, the frequency is set by something like
Freq = (df/2)*linspace(0,1,nfft/2+1);
where df is the spacing and nfft determines the length, but how do you determine the maximum?

댓글을 달려면 로그인하십시오.

### 답변 (2개)

Star Strider 2022년 5월 2일
The maximum is the Nyquist frequency, since that is the highest frequency that is uniquely resolvable in a sampled signal.
I am not certain what ‘df’ is, however if it is the sampling frequency of the original signal, then that is correct. This suggests that ‘nfft’ is something different from the length of the original signal vector, so the frequency resolution will be different as ‘nfft’ changes. The fundamental characteristic of the fft however, including the Nyquist frequency, does not change with changing values for ‘nfft’.
##### 댓글 수: 2없음 표시없음 숨기기
L'O.G. 2022년 5월 2일
편집: L'O.G. 2022년 5월 2일
Thanks, that's very helpful. I guess just one thing to follow up - how do you determine from that what the value of the Nyquist frequency is? Is it determin
Star Strider 2022년 5월 2일
Thank you!
The Nyquist frequency is one-half the sampling frequency.
This assumes that the sampling intervals are constant, such that the sampling frequency is the inverse of any single sampling interval. If they are not constant, they need to be interpolated to constant intervals with the resample function. This is necessary for essentially all signal processing on the signal, since all filtering and other operations assume constant sampling intervals. (The nufft function for non-uniformly sampled signals was introduced in R2020a, however it produces regularly-spaced frequencies. Its inverse would produce regularly-spaced time samples.)
The frequency vector calculation in your original post was introduced in the R2015a fft documentation, and remains valid.

댓글을 달려면 로그인하십시오.

Paul 2022년 5월 2일
Hi L'O.G.
If X is the output of Matlab's fft() function, then the corresponding frequency vector is:
N = numel(X);
wn = (0:(N-1))/N*2*pi, where wn has units of rad/sample (or just rad if you like), Nyquist frequency is wn = pi
wn can then be scaled to convert to other representations:
fn = wn/2/pi (cycles/sample), Nyquist frequency is fn = 1/2
wc = wn/Ts (rad/sec) where Ts is the sampling period (sec) applied to the underlying continuous-time signal used to form the input sequence to fft(), Nyquist frequency is pi/Ts
fc = wn/2/pi/Ts (cycles/sec, or Hz), Nyquist frequency is 1/Ts/2 or fs/2 where fs = 1/Ts

댓글을 달려면 로그인하십시오.

### 카테고리

Help CenterFile Exchange에서 Fourier Analysis and Filtering에 대해 자세히 알아보기

R2021b

### Community Treasure Hunt

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

Start Hunting!

Translated by