fftfilt: Filters with an FIR filter using the FFT

View source: R/fftfilt.R

fftfiltR Documentation

Filters with an FIR filter using the FFT

Description

Filters with an FIR filter using the FFT.

Usage

fftfilt(b, x, n = NULL)

FftFilter(b, n)

## S3 method for class 'FftFilter'
filter(filt, x, ...)

Arguments

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).

Details

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).

Value

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.

Author(s)

Original Octave version by Kurt Hornik and John W. Eaton. Conversion to R by Tom Short.

References

Octave Forge https://octave.sourceforge.io/

See Also

Ma, filter, fft, filtfilt

Examples

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")


signal documentation built on June 26, 2024, 9:06 a.m.

Related to fftfilt in signal...