blockMovingAverage
Moving average filter (= FIR filter with coefficients a = fill(1/n,n), but implemented recursively)
Extends from Clocked.RealSignals.Interfaces.PartialClockedSISO (Block with clocked single input and clocked single output Real signals).
Information
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
| Type | Name | Default | Description |
|---|---|---|---|
| Integer | n | 2 | Number of points that are averaged (= number of coefficients of corresponding FIR filter) |
Connectors
| Type | Name | Default | Description |
|---|---|---|---|
| Modelica.Blocks.Interfaces.RealInput | u (from PartialClockedSISO) | Connector of clocked, Real input signal | |
| Modelica.Blocks.Interfaces.RealOutput | y (from PartialClockedSISO) | Connector of clocked, Real output signal |