Skip to contents

Length-window boxcar convolution in "same" mode (output length equals input length, edges biased by zero-padding).

Usage

morie_dsp_moving_average(x, window = 5L)

Arguments

x

Numeric vector.

window

Positive integer kernel length. Default 5.

Value

Numeric vector, length(x).

References

Rangayyan & Krishnan (2015), Ch. 3, sec. 3.3.

Examples

x <- rep(2.0, 50)
morie_dsp_moving_average(x, window = 5L)
#>  [1] 1.2 1.6 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0
#> [20] 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0
#> [39] 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 1.6 1.2