Convolves x with a normalised Hann (raised-cosine) window of
length window. Less ringing than the boxcar.
Usage
morie_dsp_hann_filter(x, window = 5L)
Arguments
- x
Numeric vector.
- window
Window length. Default 5.
Value
Smoothed vector, length(x).
References
Rangayyan & Krishnan (2015), Ch. 3.
Examples
set.seed(1)
t <- seq.int(0, 199) / 200
x <- sin(2 * pi * 5 * t) + rnorm(200, sd = 0.4)
y <- morie_dsp_hann_filter(x, window = 7L)
sd(y) < sd(x) # smoothing reduces variance
#> [1] TRUE