Variable frequency moving average-value computation

**Library:**Simscape / Electrical / Control / General Control

The Moving Average (Variable Frequency) block computes the moving average value of an input signal of variable frequency. Use this block to filter higher frequency signal components and to smooth noisy signals.

The moving average is computed based on a moving time window. The moving average for continuous-time is calculated as

$$\overline{u}=\frac{1}{{T}_{0}}{\displaystyle \underset{{t}_{0}}{\overset{{t}_{0}+{T}_{0}}{\int}}u(t)dt},$$

where:

*u(t)*is the input signal.*T*is equal to $$\frac{1}{f}$$_{0}*f*is the fundamental frequency of the signal.

The moving average for discrete-time is calculated as:

$$\overline{u}(k)=\frac{1}{{T}_{0}}{\displaystyle \sum _{i=0}^{n-1}u(k-i)}.$$

The output is initialized with an initial condition in the time interval
`[0, `

.*T _{0}*]