View source: R/filter-butter.R
butter_max_order | R Documentation |
Large filter order might not be optimal, but at lease this function
provides a feasible upper bound for the order such that the
filter has a stable AR
component.
butter_max_order(
w,
type = c("low", "high", "pass", "stop"),
r = 10 * log10(2),
tol = .Machine$double.eps
)
w |
scaled frequency ranging from 0 to 1, where 1 is 'Nyquist' frequency |
type |
filter type |
r |
decibel attenuation at frequency |
tol |
tolerance of reciprocal condition number, default is
|
'Butterworth' filter in 'Arma' form.
# Find highest order (sharpest transition) of a band-pass filter
sample_rate <- 500
nyquist <- sample_rate / 2
type <- "pass"
w <- c(1, 50) / nyquist
Rs <- 6 # power attenuation at w
# max order filter
filter <- butter_max_order(w, "pass", Rs)
# -6 dB cutoff should be around 1 ~ 50 Hz
diagnose_filter(filter$b, filter$a, fs = sample_rate)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.