How do i get the Nyquist frequency from FFT and PSD?
4 views (last 30 days)
Show older comments
Jennifer Canady
on 3 Nov 2017
Commented: Star Strider
on 17 Jun 2023
Here is the code I was provided. I am unsure how to get the Nyquist frequency from the plot.
h_11 = 0.4*sinc(0.4*[-5:5]);
Npt=512;
fft_h_11 = fft(h_11,Npt); %FFT of filter
psd_h_11 = fft_h_11 .* conj(fft_h_11); %PSD of filter
psd_h_11_dB = 10*log10(psd_h_11); %PSD in dB
h_41 = 0.4*sinc(0.4*[-20:20]); %Impulse response, N=41
fft_h_41 = fft(h_41,Npt); %FFT of filter
psd_h_41 = fft_h_41 .* conj(fft_h_41); %PSD of filter
psd_h_41_dB = 10*log10(psd_h_41); %PSD in dB
omega = [1:Npt]*20/Npt; %frequency axis
subplot(2,1,1) %create an array of plots, 2 by 1
plot(omega,psd_h_11,omega,psd_h_41) %plot linear-scaled PSD
legend('10th order', '40th order')
title('Example 9-1 Linear Scale')
subplot(2,1,2) %Activate lower plot
plot(omega,psd_h_11_dB,omega,psd_h_41_dB) %plot logarithmic-scaled PSD
legend('10th order', '40th order')
title('Example 9-1 Logarithmic Scale')
0 Comments
Accepted Answer
Star Strider
on 3 Nov 2017
You do not get the Nyquist frequency from the plot, you calculate it from the data.
The Nyquist frequency is half the sampling frequency.
So:
t = ...; % Time Vector
Ts = t(2)-t(2); % Sampling Interval (Assuming Uniform Sampling)
Fs = 1/Ts; % Sampling Frequency
Fn = Fs/2; % Nyquist Frequency
I leave the rest to you.
4 Comments
Cédric Cannard
on 16 Jun 2023
Is there a way to estimate it without sampling frequency and time vector? Wouldn't the power spectrum fall down at the Nyquist frequency?
Star Strider
on 17 Jun 2023
If you know that the highest displayed frequency is the Nyquist frequency, you can infer the sampling frequency and sampling interval from it.
More Answers (0)
See Also
Categories
Find more on Fourier Analysis and Filtering in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!