Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

fftfilt

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 http://octave.sf.net

See Also

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

Signal Processing

v0.7-6
GPL-2
Authors
Uwe Ligges [aut, cre] (new maintainer), Tom Short [aut] (port to R), Paul Kienzle [aut] (majority of the original sources), Sarah Schnackenberg [ctb] (various test cases and bug fixes), David Billinghurst [ctb], Hans-Werner Borchers [ctb], Andre Carezia [ctb], Pascal Dupuis [ctb], John W. Eaton [ctb], E. Farhi [ctb], Kai Habel [ctb], Kurt Hornik [ctb], Sebastian Krey [ctb], Bill Lash [ctb], Friedrich Leisch [ctb], Olaf Mersmann [ctb], Paulo Neis [ctb], Jaakko Ruohio [ctb], Julius O. Smith III [ctb], Doug Stewart [ctb], Andreas Weingessel [ctb]
Initial release
2015-07-29

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.