View source: R/filter-filtfilt.R
filtfilt | R Documentation |
The result has been tested against 'Matlab' filtfilt
function. Currently this function only supports one filter at a time.
filtfilt(b, a, x)
b |
one-dimensional real numerical vector, the moving-average
coefficients of an |
a |
the auto-regressive (recursive) coefficients of an |
x |
numerical vector input (real value) |
The filtered signal, normally the same length as the input signal
x
.
t <- seq(0, 1, by = 0.01)
x <- sin(2 * pi * t * 2.3)
bf <- gsignal::butter(2, c(0.15, 0.3))
res <- filtfilt(bf$b, bf$a, x)
## Matlab (2022a) equivalent:
# t = [0:0.01:1];
# x = sin(2 * pi * t * 2.3);
# [b,a] = butter(2,[.15,.3]);
# res = filtfilt(b, a, x)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.