WOLFRAM SYSTEM MODELER

MovingAverage

Moving average filter (= FIR filter with coefficients a = fill(1/n,n), but implemented recursively)

Wolfram Language

In[1]:=
SystemModel["Modelica.Clocked.RealSignals.Periodic.MovingAverage"]
Out[1]:=

Information

This information is part of the Modelica Standard Library maintained by the Modelica Association.

This block computes the output y as the average of the input u and of its past values (= moving average filter):

y(i) = ( u(i) + u(i-1) + u(i-2) + … ) / n

where y(i) and u(i) are the values of y and u at clock tick i, and n are the number of u and past u values that are taken into account.

This block could also be implemented with block FIRbyCoefficients by using the coefficients a = fill(1/n, n). However, block MovingAverage is a more efficient implementation since it can be implemented recursively, contrary to a general FIR filter.

Parameters (1)

n

Value: 2

Type: Integer

Description: Number of points that are averaged (= number of coefficients of corresponding FIR filter)

Connectors (2)

u

Type: RealInput

Description: Connector of clocked, Real input signal

y

Type: RealOutput

Description: Connector of clocked, Real output signal