Professional Documents
Culture Documents
filt: Low-pass, high-pass, band-pass, and stop-pass filtering in dplR: Dendrochronology Program Library in R
Home
/
R-Forge
/
dplR
/
pass.filt: Low-pass, high-pass, band-pass, and stop-pass filtering
Description
Usage
Arguments
Details
Value
Author(s)
See Also
Examples
Description
Applies low-pass, high-pass, band-pass, or stop-pass filtering to y with frequencies (or periods) supplied by the
user.
Usage
1
pass.filt(y, W, type = c("low", "high", "stop", "pass"),
2
method = c("Butterworth", "ChebyshevI"),
3 n = 4, Rp = 1)
Arguments
Details
https://rdrr.io/rforge/dplR/man/pass.filt.html 1/4
30/08/22, 10:36 pass.filt: Low-pass, high-pass, band-pass, and stop-pass filtering in dplR: Dendrochronology Program Library in R
This function applies either a Butterworth or a Chebyshev type I filter of order n to a signal and is nothing more
rdrr.io Find an R package R language docs Run R in your browser packages, do
than a wrapper for functions in the signal package. The filters are dsigned via butter and cheby1 . The filter is
applied via filtfilt .
The input data ( y ) has the mean value subtracted and is then padded via reflection at the start and the end to a
distance of twice the maximum period. The padded data and the filter are passed to filtfilt after which the
data are unpadded and returned afer the mean is added back.
The argumement W can be given in either frequency between 0 and 0.5 or, for convenience, period (minimum
value of 2). For low-pass and high-pass filters, W must have a length of one. For low-pass and high-pass filters W
must be a two-element vector ( c(low, high) ) specifying the lower and upper boundaries of the filter.
Because this is just a wrapper for casual use with tree-ring data the frequencies and periods assume a sampling
frequency of one. Users are encouraged to build their own filters using the signal package.
Value
A filtered vector.
Author(s)
Andy Bunn. Patched and improved by Mikko Korpela.
See Also
hanning , detrend
Examples
2
data("co021")
3
x <- na.omit(co021[, 1])
5
# 20-year low-pass filter -- note freq is passed in
6
bSm <- pass.filt(x, W=0.05, type="low", method="Butterworth")
7
cSm <- pass.filt(x, W=0.05, type="low", method="ChebyshevI")
8
plot(x, type="l", col="grey")
9
lines(bSm, col="red")
10
lines(cSm, col="blue")
11
12
# 20-year high-pass filter -- note period is passed in
13
bSm <- pass.filt(x, W=20, type="high")
14
plot(x, type="l", col="grey")
15
lines(bSm, col="red")
16
17
# 20 to 100-year band-pass filter -- note freqs are passed in
18
bSm <- pass.filt(x, W=c(0.01, 0.05), type="pass")
19
cSm <- pass.filt(x, W=c(0.01, 0.05), type="pass", method="ChebyshevI")
20
plot(x, type="l", col="grey")
21
lines(bSm, col="red")
https://rdrr.io/rforge/dplR/man/pass.filt.html 2/4
30/08/22, 10:36 pass.filt: Low-pass, high-pass, band-pass, and stop-pass filtering in dplR: Dendrochronology Program Library in R
22
lines(cSm, col="blue")
24
# 20 to 100-year stop-pass filter -- note periods are passed in
25
cSm <- pass.filt(x, W=c(20, 100), type="stop", method="ChebyshevI")
lines(cSm, col="red")
Example output
https://rdrr.io/rforge/dplR/man/pass.filt.html 3/4
30/08/22, 10:36 pass.filt: Low-pass, high-pass, band-pass, and stop-pass filtering in dplR: Dendrochronology Program Library in R
https://rdrr.io/rforge/dplR/man/pass.filt.html 4/4