Skip to main content

firls

Function firls 

Source
pub fn firls(
    numtaps: usize,
    bands: &[f64],
    desired: &[f64],
    weight: Option<&[f64]>,
    fs: Option<f64>,
) -> Result<Vec<f64>, ErrorsJSL>
Expand description

A linear-phase FIR filter of odd length numtaps minimising the weighted integrated squared error to a piecewise-linear desired response (SciPy’s firls). bands holds band edges in pairs and desired the gains at those edges, as fractions of the Nyquist frequency when fs is None.

For the cosine series A(ω) = Σ aₙ cos(nω), the normal equations Q a = b have Q = T + H (a Toeplitz plus a Hankel matrix of integrals of cos(nω) over the bands) and b the integrals of the desired response times cos(nω), all in closed form.