Skip to contents

Polynomial-fit smoothing filter. Preserves higher moments (peak heights, shape) better than a moving average and is the standard tool for chromatography, spectroscopy, and biosensor smoothing.

Usage

morie_sgolay_smooth(x, window_length = 11L, polyorder = 3L)

Arguments

x

Numeric vector.

window_length

Window length (odd integer, default 11).

polyorder

Polynomial order (default 3).

Value

List with filtered (numeric vector) and name.

Examples

# \donttest{
if (requireNamespace("signal", quietly = TRUE)) {
  set.seed(1)
  t <- seq(0, 1, length.out = 200)
  x <- sin(2 * pi * 3 * t) + rnorm(200, sd = 0.2)
  y <- morie_sgolay_smooth(x, window_length = 11, polyorder = 3)
  length(y$filtered)
}
#> [1] 200
# }