MATLAB Answers

# Significance of Nyquist frequency and Maximum frequency THD computation for FFT analysis

91 views (last 30 days)
Afsher P A on 7 Feb 2021
Commented: Afsher P A on 11 Feb 2021
I am measuring the THD of a sine wave using FFT tool available in the MATLAB Simulink.
When i selected the Maximum frequency for THD compuation as Nyquist frequency in the drop down option, the measured THD is high and around 15%
and when the maximum frequency for THD computation is selected as Max frequency, the measured THD is within the standard limit.
So my question is, what is actually happening when Nyquist frequency is selected for THD computation?
For your reference a image is attached with this question.
##### 0 CommentsShowHide -1 older comments

Sign in to comment.

### Accepted Answer

David Goodmanson on 8 Feb 2021
Hi Alsher,
you don't show the horizontal frequency scale but I believe that the very small peaks have spacing 5 Hz, there are 100 Hz per major division, the large peaks are odd multiples of 50 Hz and the total frequency span is roughly 1000 Hz. The standard calculaton for THD is
THD = sqrt(v2^2 + v3^2 + v4^2 ...)/v1
where v1 is the amplitude of the fundamental and v2,v3.. up to some limit are the amplitudes of the harmoniics. The Maxfreq THD calculation appears to cover just the frequencies shown in the plot (harmonics below 1 kHZ) and appears to be correct under that assumption.
The nyquist frequency is the max frequency calculated by the fft and is half of the sampling rate of the instrument in sec^-1 or Hz. Without either the sampling rate or the number of points in the FFT it is not possible to find the nyquist frequency with the information given. However, it must be much, much higher than 1000Hz,maybe 50 times higher. But you will have that info. Anyway, going up to nyquist includes a lot more frequencies and raises the THD by a lot.
Where to stop the sum is a matter of judgment, especially if there is no high frequency filter or high frequency rolloff as there would be for an analog amplifier.
If you select out a chunk of the time domain waveform as is done here, you can get spurious high frequency content if the ends of the waveform are not trimmed carefully. But if the 10 cycles is a software choice I assume Matlab is doing that carefully.
##### 1 CommentShowHide None
Afsher P A on 11 Feb 2021
Hi
Sorry for the late reply.
Here I am attaching the picture which contains the x-axis (Frequency). In both the cases (Nyquist freq & Max freq selection for THD computation), I found that the plots are the same but the THD values are different (one high value for Nyquist frequency and one within the standard limit for max freq).
As explained by you, I selected the maximum frequency of 50000 Hz (50 times the max frequency in the earlier case) and done the FFT analysis for the same with max frequency as the maximum frequency for the THD computation. Now it has the same value as that of the earlier case, where the maximum frequency for the THD computation is selected as Nyquist frequency. Now the plot also has an x-axis up to 50000Hz. In normal FFT analysis, the plots shown by MATLAB were a little confusing.

Sign in to comment.

### Community Treasure Hunt

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

Start Hunting!