HarmonicEstimation (FPScript)

21.09.2021

Estimates the least-squares harmonic components of a signal.

Syntax

HarmonicEstimation(Signal, [ Result = HARMONIC_COMPONENTS ], [ Algorithm = HARMONIC_AUTO ], [ Components = 60 dB ], [ Order ] [ , Model = HARMONIC_SINE ])

 

The syntax of the HarmonicEstimation function consists of the following parts:

Part

Description

Signal

The data to be analyzed.

Permitted data structures are data series und signal. All real data types are permitted.

If the argument is a list, then the function is executed for each element of the list and the result is also a list.

Result

The harmonic information to be returned.

The argument Result can have the following values:

Constant

Meaning

HARMONIC_COMPONENTS

Signal with amplitudes and frequencies of harmonic components.

HARMONIC_DISTORTIONPERC

Harmonic distortion spectrum %. Is a cumulative spectrum of distortion which is given as the ratio of the principal harmonic to the individual secondary harmonics.

HARMONIC_DISTORTIONDB

Harmonic distortion spectrum dB. Equal to HARMONIC_DISTORTIONPERC, but converted into decibels with the formula 10.0 * log10(Ratio).

HARMONIC_THD

Total Harmonic Distortion (THD) %. A scalar value with ratio of the square root of the sum of the powers or squared amplitudes of all harmonic frequencies above the fundamental frequency to the amplitude of the fundamental frequency converted into decibels.

HARMONIC_SNR

Signal to Noise Ratio (SNR) dB. A scalar value with the ratio of the sum of the powers of all of all harmonic frequencies including the fundamental frequency to the power of the noise in the signal.

HARMONIC_SINAD

SINAD dB. A scalar value with the ratio of the power of the whole signal including all harmonic components and the noise to the sum of the powers of all secondary harmonic frequencies and the noise converted into decibels.

HARMONIC_RECONSTRUCT

The denoised signal reconstructed from the fitted sinusoidal or damped sinusoidal model.

HARMONIC_STATISTICS

The frequencies, amplitudes, phases and, in case of a damped sinusoidal model, the damping coefficients of all harmonic components as a data matrix with three or four columns. Please note that the reported phases are sine-based phases and therefore differ from the cosine-based phases reported by the Fourier procedures.

If the argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated.

If this argument is omitted, it will be set to the default value HARMONIC_COMPONENTS.

Algorithm

The algorithm for estimating the frequencies.

The argument Algorithm can have the following values:

Constant

Meaning

HARMONIC_AUTO

Automatically use the best algorithm.

HARMONIC_FOURIER

Fourier Spectrum

HARMONIC_FOURIERUNEVEN1X

Uneven data Fourier spectrum with a Nyquist-multiple of 1.

HARMONIC_FOURIERUNEVEN2X

Uneven data Fourier spectrum with a Nyquist-multiple of 2.

HARMONIC_FOURIERUNEVEN4X

Uneven data Fourier spectrum with a Nyquist-multiple of 4.

HARMONIC_AR_DATASVDFB

Principal component AR SVD.

HARMONIC_EIGEN_MUSIC

Root MUSIC EigenAnalysis.

HARMONIC_PRONY

Prony complex exponential modeling.

HARMONIC_LINEARMODELING

No automatic estimation of frequencies. Instead, a linear model for a given list of frequencies is fitted to obtain the amplitudes and phases.

If the argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated.

If this argument is omitted, it will be set to the default value HARMONIC_AUTO.

Components

Controls the number of components to be output or their frequencies. Can be specified via count, a positive number from 1 to 100, by a dB threshold, a negative number from -0.01 to -300 or as a data series with specified frequencies. If you specify a data series with frequencies, then the argument Algorithm must be set to the value HARMONIC_LINEARMODELING.

Permitted data structures are scalar value und data series. All real data types are permitted.

If the argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated.

If this argument is omitted, it will be set to the default value 60 dB.

Order

The Autoregressive or Eigenanalysis model order. The valid range is between 1 and the smaller of 100 and 1/2 the data length - 1. The argument is optional. The default is the smaller of 50 and 1/2 the data length - 1.

Permitted data structures are scalar value. All integral data types are permitted.

If the argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated.

Model

The model to be used.

The argument Model can have the following values:

Constant

Meaning

HARMONIC_SINE

Sinusoidal: Y=Ampl*sin(2*PI*Freq*X+Phase)

HARMONIC_SINEDECAY

Damped sinusoidal: Y=Ampl*exp(-k*X)*sin(2*PI*Freq*X+Phase)

If the argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated.

If this argument is omitted, it will be set to the default value HARMONIC_SINE.

Remarks

The HarmonicEstimation function generates a parametric (sinusoidal or attenuated sinusoidal) model of the signal. The harmonic modeling algorithm has two stages. In the first optional stage, an AR, Prony, Eigenanalysis, or Fourier algorithm is used to determine the number of spectral components and their frequencies. Alternatively you can provide these frequencies as a data series. In the second stage a linear fit is made to determine the amplitudes and phases.

Available in

Option Spectral Analysis

Examples

HarmonicEstimation(Signal, HARMONIC_COMPONENTS, HARMONIC_FOURIER, 10, 40, HARMONIC_SINE)

Harmonic estimation of the signal 'Signal'. For this, Fourier is selected as the algorithm and Sinusoidal is selected as the model. This is an example from the Harmonic Estimation Tutorial.

See Also

Spectral Analysis Option

Harmonic Estimation Analysis Object

Harmonic Modeling

AR algorithm

EigenAnalysis Algorithm

Prony Algorithm

Fourier Spectral Analysis

Harmonic Estimation Tutorial

Share article or send as email:

You might be interested in these articles