Main Content

pe_calculateThdPercent

Compute the total harmonic distortion (THD) percentage

Description

example

[thdPercent] = pe_calculateThdPercent(harmonicOrder,...
harmonicMagnitude)
calculates the total harmonic distortion (THD) percentage using these equations:

M=harmonic magnitude2,

and

%THD=100i=2nMi2M1,

where:

  • Mi is the root mean square (RMS) value of the harmonic magnitude corresponding to the ith harmonic order.

  • M is VRMS or IRMS as required.

You can use the ee_getHarmonics function to obtain the vectors of harmonic order and harmonic magnitude for a simscape.logging.Node.

Examples

collapse all

Calculate the THD from harmonic orders [1;5;7;11;13] and harmonic magnitudes [1.1756e+03;0.0437e+03;0.0221e+03;0.0173e+03;0.0127e+03].

harmonicOrder = [1;5;7;11;13];
harmonicMagnitude = [1.1756e+03;0.0437e+03;0.0221e+03;0.0173e+03;...
    0.0127e+03];
thdPercent = pe_calculateThdPercent( harmonicOrder, harmonicMagnitude )
thdPercent = 4.5480

Input Arguments

collapse all

Harmonic orders from 0 up to and including number of harmonics, specified as a vector.

Example: [1;5;7;11;13]

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

Harmonic magnitudes from the 0th harmonic up to and including the number of harmonics included in the analysis, specified as a vector.

Example: [1.1756e+03;0.0437e+03;0.0221e+03;0.0173e+03;0.0127e+03]

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

Version History

Introduced in R2014a

expand all