Example Code

Total Harmonic Distortion (THD)

Code and Documents

Attachment

A 1 kHz tone is generated, and its harmonic spectrum is shown for various types of distortion. The Total Harmonic Distortion (THD) in % relative to the fundamental tones level.

Experiment #1: Try different Distortion Types, and note the resulting Frequency Spectrum.

Experiment #2: Note that level of the fundamental can also change relative to the original level. You can see its precise value is the list of the first five harmonics in the lower right hand corner.

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Contributors