Moving Average

Purpose

Continuously average input signal over specified time period

Library

Control / Filters

Description

../../_images/movingaverage.svg

The Moving Average filter averages a continuous input signal \(u\) over the specified averaging time \(T\). The output \(y\) is continuously updated in every simulation step:

\[y(t) = \frac{1}{T} \int_{t-T}^{t} u(\tau) \, d\tau\]

The implementation of this block avoids accumulating numerical integration errors typically associated with continuous-time implementations of FIR filters. However, the Moving Average filter is computationally more expensive and less accurate than the similar Periodic Average.

Parameters

Initial Condition

The initial condition describes the input signal before simulation start. If the input is a scalar signal, the parameter must be a scalar too. If input and output are vectorized signals, a vector can be used. The number of elements in the vector must match the number of input signals. The default value of this parameter is 0.

Averaging time

A scalar specifying the period or a two-element vector specifying the period and offset of the averaging interval, in seconds \((\mathrm{s})\). See also the Discrete-Periodic sample time type in Sample Times.

Probe Signals

Input

The input signal.

Output

The filtered output signal.