Last chance! 50% off unlimited learning
Sale ends in
Create digital filters.
Deprecation warning: This function is mainly used for patchlamp recordings and may be transferred to a specialised package.
dfilter(type = c("bessel", "gauss", "custom"), param = list(pole = 4, cutoff = 1 / 10),
len = ceiling(3/param$cutoff))
# S3 method for dfilter
print(x, …)
allows to choose Bessel, Gauss or custom filters
for a "bessel"
filter a list
with entries pole
and cutoff
giving the filter's number of poles (order) and cut-off frequency, resp.; for a "gauss"
filter the filter's bandwidth (standard deviation) as a single numeric
; for a custom filter either a numeric
vector specifying the filter's kernel or a list with items kern
and step
of the same length giving the filter's kernel and step-response, resp.
filter length (unnecessary for "custom"
filters
the object
for generic methods only
Returns a list of class
dfilter
that contains elements kern
and step
, the (digitised) filter kernel and step-response, resp., as well as an element param
containing the argument param
, for a "bessel"
filter alongside the corresponding analogue kernel, step response, power spectrum, and autocorrelation function depending on time or frequency as elements kernfun
, stepfun
, spectrum
, and acfun
, resp.
# NOT RUN {
# 6-pole Bessel filter with cut-off frequency 1 / 100, with length 100 (too short!)
dfilter("bessel", list(pole = 6, cutoff = 1 / 100), 100)
# custom filter: running mean of length 3
dfilter("custom", rep(1, 3))
dfilter("custom", rep(1, 3))$kern # normalised!
dfilter("custom", rep(1, 3))$step
# Gaussian filter with bandwidth 3 and length 11 (from -5 to 5)
dfilter("gauss", 3, 11)
# }
Run the code above in your browser using DataLab