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

fir1

FIR filter generation


Description

FIR filter coefficients for a filter with the given order and frequency cutoff.

Usage

fir1(n, w, type = c("low", "high", "stop", "pass", "DC-0", "DC-1"), 
     window = hamming(n + 1), scale = TRUE)

Arguments

n

order of the filter (1 less than the length of the filter)

w

band edges, strictly increasing vector in the range [0, 1], where 1 is the Nyquist frequency. A scalar for highpass or lowpass filters, a vector pair for bandpass or bandstop, or a vector for an alternating pass/stop filter.

type

character specifying filter type, one of "low" for a low-pass filter, "high" for a high-pass filter, "stop" for a stop-band (band-reject) filter, "pass" for a pass-band filter, "DC-0" for a bandpass as the first band of a multiband filter, or "DC-1" for a bandstop as the first band of a multiband filter.

window

smoothing window. The returned filter is the same shape as the smoothing window.

scale

whether to normalize or not. Use TRUE or 'scale' to set the magnitude of the center of the first passband to 1, and FALSE or 'noscale' to not normalize.

Value

The FIR filter coefficients, an array of length(n+1), of class Ma.

Author(s)

Original Octave version by Paul Kienzle, pkienzle@user.sf.net. Conversion to R by Tom Short.

References

Octave Forge http://octave.sf.net

See Also

Examples

freqz(fir1(40, 0.3))
freqz(fir1(10, c(0.3, 0.5), "stop"))
freqz(fir1(10, c(0.3, 0.5), "pass"))

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.