Note: This page has been translated by MathWorks. Please click here

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Total harmonic distortion

`r = thd(x)`

`r = thd(x,fs,n)`

`r = thd(pxx,f,'psd')`

`r = thd(pxx,f,n,'psd')`

`r = thd(sxx,f,rbw,'power')`

`r = thd(sxx,f,rbw,n,'power')`

`r = thd(___,'aliased')`

```
[r,harmpow,harmfreq]
= thd(___)
```

`thd(___)`

returns
the total harmonic distortion (THD) in dBc of the real-valued sinusoidal
signal `r`

= thd(`x`

)`x`

. The total harmonic distortion is determined
from the fundamental frequency and the first five harmonics using
a modified periodogram of the same length as the input signal. The
modified periodogram uses a Kaiser window with * β* = 38.

reports
harmonics of the fundamental that are aliased into the Nyquist range.
Use this option when the input signal is undersampled. If you do not
specify this option, or if you set it to `r`

= thd(___,'aliased')`'omitaliases'`

,
then the function ignores any harmonics of the fundamental frequency
that lie beyond the Nyquist range.

`thd(___)`

with no output arguments
plots the spectrum of the signal and annotates the harmonics in the
current figure window. It uses different colors to draw the fundamental
component, the harmonics, and the DC level and noise. The THD appears
above the plot. The fundamental and harmonics are labeled. The DC
term is excluded from the measurement and is not labeled.

Was this topic helpful?