MovingAverage model

Requirements.Examples.Elementary.SignalAnalysis.MovingAverage  ยท source

Icon of MovingAverage

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

NameTypeDescription
sineModelica.Blocks.Sources.SineSine at 0.3 Hz with offset 2: the averaged signal
pulseModelica.Blocks.Sources.BooleanPulseActivation signal: pulse with period 3 s, starting at 1 s
movAv1Requirements.SignalAnalysis.MovingAverageMoving average of the sine over 0.2 s while pulse is true