notch_filter | R Documentation |
Apply 'Notch' filter
notch_filter(
s,
sample_rate,
lb = c(59, 118, 178),
ub = c(61, 122, 182),
domain = 1
)
s |
numerical vector if |
sample_rate |
sample rate |
lb |
filter lower bound of the frequencies to remove |
ub |
filter upper bound of the frequencies to remove;
shares the same length as |
domain |
|
Mainly used to remove electrical line frequencies
at 60, 120, and 180 Hz
.
filtered signal in time domain (real numerical vector)
time <- seq(0, 3, 0.005)
s <- sin(120 * pi * time) + rnorm(length(time))
# Welch periodogram shows a peak at 60Hz
pwelch(s, 200, plot = 1, log = "y")
# notch filter to remove 60Hz
s1 <- notch_filter(s, 200, lb = 59, ub = 61)
pwelch(s1, 200, plot = 2, log = "y", col = "red")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.