Skip to contents

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.

Usage

butthp(x, fs, cutoff, order = 4L)

Arguments

x

Numeric vector.

fs

Sampling frequency (Hz).

cutoff

Cutoff frequency (Hz).

order

Filter order (default 4).

Value

List with filtered (numeric vector), fs, order, name.

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
# }