packages

signal::filter::fir

FIR design by the window method: the ideal (sinc) impulse response of the band, times a window, scaled to unit gain at the centre of the first pass band (as SciPy's firwin).

Functions

firwinSource

pub fn firwin(numtaps: usize, band: Band, window: Window = Window::Hamming, scale: bool = true, fs: f64 = 2.0) throws (SignalError) -> Vector<f64>

A linear-phase FIR filter of numtaps coefficients for band (edges in units of fs), windowed by window (Hamming by default). With scale the gain is exactly 1 at 0 Hz for low-pass and band-stop, at Nyquist for high-pass, and at the band centre for band-pass. High-pass and band-stop need an odd numtaps (an even one has a zero at Nyquist).

nabi
use signal::filter::{Band, firwin};

let h = try firwin(5, Band::Lowpass(0.5));
println(h.sum()); // 1.0 (to rounding)