firls: Least-squares linear-phase FIR filter design

View source: R/firls.R

firlsR Documentation

Least-squares linear-phase FIR filter design

Description

Produce a linear phase filter such that the integral of the weighted mean squared error in the specified bands is minimized.

Usage

firls(n, f, a, w = rep(1L, length(a)/2))

Arguments

n

filter order (1 less than the length of the filter). Must be even. If odd, it is incremented by one.

f

vector of frequency points in the range from 0 to 1, where 1 corresponds to the Nyquist frequency. Each band is specified by two frequencies, so the vector must have an even length. .

a

vector of the same length as f containing the desired amplitude at each of the points specified in f.

w

weighting function that contains one value for each band that weights the mean squared error in that band. w must be half the length of f.

Details

The least squares optimization algorithm for computing FIR filter coefficients is derived in detail in [1].

Value

The FIR filter coefficients, a vector of length n + 1, of class Ma.

Author(s)

Quentin Spencer, qspencer@ieee.org.
Conversion to R by Geert van Boxtel, G.J.M.vanBoxtel@gmail.com.

References

[1] I. Selesnick, "Linear-Phase FIR Filter Design by Least Squares", https://cnx.org/contents/6x7LNQOp@7/Linear-Phase-Fir-Filter-Design-By-Least-Squares

See Also

Ma, filter, fftfilt, fir1

Examples

freqz(firls(255, c(0, 0.25, 0.3, 1), c(1, 1, 0, 0)))


gjmvanboxtel/gsignal documentation built on Nov. 22, 2023, 8:19 p.m.