Zero-phase Butterworth highpass filter. Removes low-frequency drift while preserving higher-frequency content; useful for de-trending physiological signals (EEG, ECG) prior to analysis.
Examples
# \donttest{
if (requireNamespace("signal", quietly = TRUE)) {
set.seed(1)
t <- seq(0, 1, length.out = 500)
x <- 5 * t + sin(2 * pi * 10 * t) # linear drift + 10 Hz signal
y <- butthp(x, fs = 500, cutoff = 1)
length(y$filtered)
}
#> [1] 500
# }