firls
Least-squares linear-phase FIR filter design
Description
Examples
Input Arguments
Output Arguments
More About
Algorithms
firls
designs a linear-phase FIR filter that minimizes the weighted
integrated squared error between an ideal piecewise linear function and the magnitude response
of the filter over a set of desired frequency bands.
Reference [2] describes the theoretical
approach behind firls
. The function solves a system of linear equations
using the MATLAB^{®}
\
operator. For a filter of order n, the solution of the equation system involves an inner-product square matrix
of size L, where L = (n–1)/2 + 1 when n is odd, and L = n/2 + 1 when n is even.
The input arguments f and a specify the frequency-amplitude characteristics of the filter:
f is a vector of pairs of frequency points, specified in the range 0 to 1, where 1 corresponds to the Nyquist frequency. The frequencies must be in increasing order. You can specify duplicate frequency points.
a is a vector containing the desired amplitudes at the points specified in f.
The desired amplitude function at frequencies between pairs of points (f(k), f(k+1)) for k odd is the line segment connecting the points (f(k), a(k)) and (f(k+1), a(k+1)).
The desired amplitude function at frequencies between pairs of points (f(k), f(k+1)) for k even is unspecified. These are transition ("don’t care") regions.
f and a are the same length. This length must be an even number.
This figure illustrates the relationship between the vectors f and a in defining a desired amplitude response.
The firls
function designs type I, II, III, and IV linear-phase
filters. Type I and II are the default filters when n is even and odd, respectively, while the
'hilbert'
and 'differentiator'
flags produce type III
(n is even) and IV (n is odd) filters. The various filter types have different symmetries and
constraints on their frequency responses (see [1] for details).
Linear Phase Filter Type | Filter Order | Symmetry of Coefficients | Response H(f), f = 0 | Response H(f), f = 1 (Nyquist) |
---|---|---|---|---|
Type I | Even | $$b(k)=b(n+2-k),\text{\hspace{1em}}k=1,\mathrm{...},n+1$$ | No restriction | No restriction |
Type II | Odd | $$b(k)=b(n+2-k),\text{\hspace{1em}}k=1,\mathrm{...},n+1$$ | No restriction | H(1) = 0 |
Type III | Even | $$b(k)=-b(n+2-k),\text{\hspace{1em}}k=1,\mathrm{...},n+1$$ | H(0) = 0 | H(1) = 0 |
Type IV | Odd | $$b(k)=-b(n+2-k),\text{\hspace{1em}}k=1,\mathrm{...},n+1$$ | H(0) = 0 | No restriction |
References
[1] Oppenheim, Alan V., and Ronald W. Schafer, with John R. Buck. Discrete-Time Signal Processing. Upper Saddle River, NJ: Prentice Hall, 1999.
[2] Parks, Thomas W., and C. Sidney Burrus. Digital Filter Design. Hoboken, NJ: John Wiley & Sons, 1987, pp. 54–83.