What determines the maximum frequency when taking the FFT?
37 views (last 30 days)
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?
Star Strider on 2 May 2022
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’.
Paul on 2 May 2022
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