| DSP Blockset | Search  Help Desk |
Special IIR and FIR Filters, Discrete-Time
The Remez FIR Filter Design, Yule-Walker IIR Filter Design, and Least Squares FIR Filter Design blocks design and implement IIR or FIR filters with arbitrary magnitude responses, including multiband responses.
All of these blocks automatically apply the designed filter to an input. Each incorporates the Direct-Form II Transpose Filter block from the Filter Realizations library, which yields the same results as the filter function in the Signal Processing Toolbox.
Filter Design Characteristics
Yule-Walker IIR Filter Design. The Yule-Walker IIR Filter Design block designs recursive IIR digital filters by fitting a specified frequency response based on arbitrary piecewise linear magnitude responses. For more on the Yule-Walker algorithm, see the description of theyulewalk function in the Signal Processing Toolbox User's Guide.
Remez FIR and Least Squares FIR Filter Design.
The Remez FIR Filter Design and Least Squares FIR Filter Design blocks design FIR filters using the Parks-McClellan and least-squares techniques, respectively. These techniques reflect two error minimization schemes that provide optimal fits to a desired frequency response, each using a different definition of "optimal fit."
The Remez FIR Filter Design implements the Parks-McClellan algorithm, which uses the Remez exchange algorithm and Chebyshev approximation theory to design filters with optimal fits between the desired and actual frequency responses. The filters are optimal in the sense that they minimize the maximum error between the desired frequency response and the actual frequency response over the designated bands. Filters designed in this way exhibit an equiripple behavior in their frequency response, and hence are also known as equiripple filters.
The Least Squares FIR Filter Design block minimizes the integral of the squared error between the desired frequency response and the actual frequency response. This technique provides a better response over most of the passband and stopband than does the Parks-McClellan algorithm. At the band edges, however, the least-squares technique provides a poorer fit than does an equiripple filter designed to fit the same response.
For more on the Parks-McClellan and least squares design techniques, see the descriptions of the remez and firls functions, respectively, in the Signal Processing Toolbox User's Guide.
Frequency and Magnitude Parameters
All of these blocks let you design filters with any magnitude response. The response can include multiple stopbands, passbands, and transition regions. You specify the desired frequency response using the blocks' Band edge frequency vector and Magnitudes at these frequencies parameters. These parameters specify the range and magnitude, respectively, of the frequency bands that make up the filter's frequency response. Think of frequency bands as lines over short frequency intervals. The blocks use this scheme to represent any piecewise linear function. A simple bandpass example is[0 0.3 0.4 0.6 0.7 1], which specifies the desired frequency points.
[0 1 0 0 0.5 0.5], which defines the magnitudes corresponding to the frequencies above.

0.4 to 0.6
0.7 to 1
0 to 0.3, 0.3 to 0.4, and 0.6 to 0.7
0 to 1, where 1 corresponds to half the sampling frequency (the Nyquist frequency). The Magnitudes at these frequencies vector contains the desired magnitude response at the points in the Band edge frequency vector. The two vectors must be the same length.
For the Yule-Walker IIR Filter Design block, the Band edge frequency vector and Magnitudes at these frequencies parameters must start with 0 and end with 1, and describe a piecewise linear magnitude response over the entire frequency range, as shown in the previous figure. In this case, the "transition regions" are linear segments connecting the defined bands.
For the Remez FIR Filter Design and Least Squares FIR Filter Design blocks, the Band edge frequency vector and Gains at these frequencies vectors describe linear magnitude segments, as shown below. The distances between segments represent "don't care" or transition regions. Both vectors must have even length.

Weight Parameters
The Remez FIR Filter Design and Least Squares FIR Filter Design blocks allow you to weight the error minimization in certain frequency bands by entering a vector for the band Weights. The Weights parameter is useful when designing a compound filter (for example, a lowpass differentiator). For example, to specify a lowpass filter with a transition region in the normalized frequency range 0.4 to 0.5, and 10 times more error minimization in the stopband than the passband, use:[0 0.4 0.5 1]
[1 1 0 0]
[1 10]
Example: Least Squares Multiband Filter
To try a multiband filter, create a model like the one shown below. You can create this easily by modifying the Chebyshev type II lowpass filter model in the previous example.
..1.
..16
[0 125 175 225 275 325 375 500]/500
(For a sample rate of 1 kHz, divide by 500, the Nyquist frequency.)

.inf, and start the
simulation by selecting Start from the Simulation menu.
.