Least-squares linear-phase FIR filter design
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
involving an inner product matrix of roughly the size n\2
using the
MATLAB®
\
operator.
These are type I (n
is odd) and type II (n
is even)
linear-phase filters. Vectors 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. Duplicate frequency points are allowed and, in fact, can be used to
design a filter that is exactly the same as the filters returned by the fir1
and fir2
functions with a rectangular (rectwin
) window.
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 f
and
a
vectors in defining a desired amplitude response.
This 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 | No restriction | No restriction | |
Type II | Odd | No restriction | H(1) = 0 | |
Type III | Even | H(0) = 0 | H(1) = 0 | |
Type IV | Odd | H(0) = 0 | No restriction |
[1] Oppenheim, Alan V., Ronald W. Schafer, and 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.
fir1
| fir2
| firpm
| rcosdesign