fftfilt | R Documentation |
Filters with an FIR filter using the FFT.
fftfilt(b, x, n = NULL)
FftFilter(b, n)
## S3 method for class 'FftFilter'
filter(filt, x, ...)
b |
the moving-average (MA) coefficients of an FIR filter. |
x |
the input signal to be filtered. |
n |
if given, the length of the FFT window for the overlap-add method. |
filt |
filter to apply to the signal. |
... |
additional arguments (ignored). |
If n
is not specified explicitly, we do not use the overlap-add
method at all because loops are really slow. Otherwise, we only
ensure that the number of points in the FFT is the smallest power
of two larger than n
and length(b)
.
For fftfilt
, the filtered signal, the same length as the input
signal x
.
For FftFilter
, a filter of class FftFilter
that can be
used with filter
.
Original Octave version by Kurt Hornik and John W. Eaton. Conversion to R by Tom Short.
Octave Forge https://octave.sourceforge.io/
Ma
, filter
, fft
, filtfilt
t <- seq(0, 1, len = 100) # 1 second sample
x <- sin(2*pi*t*2.3) + 0.25*rnorm(length(t)) # 2.3 Hz sinusoid+noise
z <- fftfilt(rep(1, 10)/10, x) # apply 10-point averaging filter
plot(t, x, type = "l")
lines(t, z, col = "red")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.