Click or drag to resize

MovingWindowFilterExponentiallyWeightedMovingAverageCoefficients Method

Returns a vector of exponentially weighted moving average (EWMA) coefficients of length n.

Namespace: CenterSpace.NMath.Core
Assembly: NMath (in NMath.dll) Version: 7.4
Syntax
public static DoubleVector ExponentiallyWeightedMovingAverageCoefficients(
	int n
)

Parameters

n  Int32
Exponential moving average filter length.

Return Value

DoubleVector
The vector of coefficients implementing an exponentially weighted moving average filter.
Exceptions
ExceptionCondition
InvalidArgumentExceptionThe filter length, n, must be greater than zero.
Remarks
As the number of EWMA coefficients increases, the filter will capture at most %86.47 of the total weight due to the finite length of the filter. The filter length
C#
and the exponential weight
C#
alpha
are related by
C#
alpha = 2 / (n + 1)
.
Example
DoubleVector coef = MovingWindowFilter.ExponentiallyWeightedMovingAverageCoefficients( 18 ); MovingWindowFilter EWMAfilter = new MovingWindowFilter( 0, coef.Length - 1, coef ); DoubleVector filtered = EWMAfilter.Filter( data );
See Also