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

Namespace:  CenterSpace.NMath.Core
Assembly:  NMath (in NMath.dll) Version: 5.1.0.0

Syntax

C#
public static DoubleVector ExponentiallyWeightedMovingAverageCoefficients(
	int n
)
Visual Basic (Declaration)
Public Shared Function ExponentiallyWeightedMovingAverageCoefficients ( _
	n As Integer _
) As DoubleVector
Visual C++
public:
static DoubleVector^ ExponentiallyWeightedMovingAverageCoefficients(
	int n
)

Parameters

n
Type: System..::.Int32
Exponential moving average filter length.

Return Value

The vector of coefficients implementing an exponentially weighted moving average filter.

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
CopyC#
n
and the exponential weight
CopyC#
alpha
are related by
CopyC#
alpha = 2 / (n + 1)
.

Examples

DoubleVector coef = MovingWindowFilter.ExponentiallyWeightedMovingAverageCoefficients( 18 ); MovingWindowFilter EWMAfilter = new MovingWindowFilter( 0, coef.Length - 1, coef ); DoubleVector filtered = EWMAfilter.Filter( data );

Exceptions

ExceptionCondition
CenterSpace.NMath.Core..::.InvalidArgumentExceptionThe filter length, n, must be greater than zero.

See Also