MovingAverage model
Requirements.Examples.Elementary.SignalAnalysis.MovingAverage
ยท source
Example for MovingAverage (output is the continuous moving average of the input, as long as input active is true)
Extends Modelica.Icons.Example
Using signal analysis block MovingAverage as
results in
![]() | |
| simulation result |
The input u of MovingAverage is a sine
of 0.3 Hz around an offset of 2, the Boolean input active is a pulse of period 3 s that starts at 1 s. The
output is the continuous moving average of the sine over the last T = 0.2 s, computed only while
active is true. Compare the output with the sine to see the smoothing and delay of the average.
Components and variables
| Name | Type | Description |
|---|---|---|
sine | Modelica.Blocks.Sources.Sine | Sine at 0.3 Hz with offset 2: the averaged signal |
pulse | Modelica.Blocks.Sources.BooleanPulse | Activation signal: pulse with period 3 s, starting at 1 s |
movAv1 | Requirements.SignalAnalysis.MovingAverage | Moving average of the sine over 0.2 s while pulse is true |

