Analysis  General
I am simulating an audio amplifier. My transient analysis is running fine, and now I would like to measure the total harmonic distortion of my amplifier output. How do I do this measurement?
The total harmonic distortion of a waveform can be calculated through the use of the THD function. The THD function has the following syntax:
THD(S[,F])
where S is the waveform spectrum, and F is an optional parameter that specifies the fundamental frequency. If the F parameter is not specified, then the fundamental frequency is calculated through the time range specified in the FFT page of the Analysis Properties dialog box by the following equation:
F = 1/(Upper Time Limit  Lower Time Limit)
In the Transient Analysis Limits dialog box, the THD function needs to be entered on a new waveform line. Set the X Expression field to F since the distortion should be plotted versus frequency. If the THD is to be measured at node Out, the Y Expression field would be defined as:
THD(HARM(V(Out)))
The HARM(V(Out)) portion produces the waveform spectrum needed for the THD calculation. In this case, the fundamental frequency would be calculated from the FFT page of the Analysis Properties dialog box. However, if the fundamental frequency needed to be set to a specific value such as 1kHz, the expression above could be modified to:
THD(HARM(V(Out)),1k)
Run the transient simulation. The plot displays a running total of the THD measurement. For example, if the fundamental frequency is 1kHz, the data point at 4kHz would show the THD value of all of the harmonics after 1kHz up to and including the harmonic at 4kHz.
There is also an individual harmonic distortion function available in MicroCap. Its syntax is:
IHD(S[,F])
This function operates in the same manner as the THD function except that it shows just the individual distortion of each harmonic.
Both the THD and the IHD can also be plotted in an FFT window. Right click on the plot expression or go to the Transient / FFT Windows menu and select Add FFT Window. In the What to Plot section of the Plot page, both THD and IHD are available as options. The fundamental frequency for these plots will be determined by the Frequency Step field in the FFT page of this dialog box.
