Main Content

Total Harmonic Distortion

Total harmonic distortion measurement

  • Total Harmonic Distortion block

Libraries:
Simscape / Electrical / Control / Measurements

Description

The Total Harmonic Distortion block calculates the total harmonic distortion (THD) percentage using these equations:

M=harmonic magnitude2,

and

%THD=100i=2nMi2M1,

where:

  • Mi is the root mean squared (RMS) value of the harmonic magnitude that corresponds to the ith harmonic order.

  • M is VRMS or IRMS.

  • i=2nMi2 is the sum of all harmonic components.

Ports

Input

expand all

Harmonic magnitude.

Data Types: single | double

Output

expand all

Total harmonic distortion as a percentage.

Data Types: single | double

Parameters

expand all

Fundamental frequency, in Hz.

Time between consecutive block executions. During execution, the block produces outputs and, if appropriate, updates its internal state. For more information, see What Is Sample Time? and Specify Sample Time.

For inherited discrete-time operation, specify -1. For discrete-time operation, specify a positive integer. For continuous-time operation, specify 0.

To improve accuracy, set this value at least 10 times smaller than the Time constant parameter.

Note

If this block is in a masked subsystem, or another variant subsystem that allows either continuous or discrete operation, promote the sample time parameter to ensure correct switching between the continuous and discrete implementations of the block. For more information, see Promote Block Parameters on a Mask.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.

Version History

Introduced in R2019b