Version:

Last Modified: March 15, 2017

Calculates the short-term and long-term moving average of an input signal. If you do not specify an output, this function plots the input signal, the long-term moving average, and the short-term moving average in the current plot window.

movavg(x, a, b)

movavg(x, a, b, alpha)

movavg(x, a, b, 'e')

short = movavg(x, a, b)

short = movavg(x, a, b, alpha)

short = movavg(x, a, b, 'e')

[short, long] = movavg(x, a, b)

[short, long] = movavg(x, a, b, alpha)

[short, long] = movavg(x, a, b, 'e')

Input signal. x is a real, double-precision, floating-point scalar or vector.

Specifies the averaging length for short-term moving average. a is a positive integer.

Averaging length for long-term moving average. b is a positive integer, and b is larger than or equal to a.

Weighting power of the delay. alpha is a real, double-precision, floating-point scalar.

**Default: **0

Specifies to calculate the exponential moving average.

Short-term moving average of the input signal. short is a real, double-precision, floating-point scalar or vector.

Long-term moving average of the input signal. long is a real, double-precision, floating-point scalar or vector.

X = [1 2 3 4 5]; [short, long] = movavg(X, 2, 4)

**Where This Node Can Run: **

Desktop OS: Windows

FPGA: This product does not support FPGA devices