Filter Design Toolbox    

Designing the IIR Filter

Start to design the filter by clearing the MATLAB workspace and defining the four required vectors:

  1. Clear your MATLAB workspace of all variables and close all your open figure windows. Enter

  1. clear; close all;

  1. At the MATLAB prompt, enter the following commands to create the four vectors that define the desired IIR filter frequency response.

  1. Now specify the amplitude at each passband frequency. We use the right array divide operator (./) to perform element-wise division.

    Use PBfreq and PBamp to generate the final frequency F and amplitude A vectors for our IIR filter. While defining these vectors, define edges and W, the edge and weight vectors.

    Issuing these commands created four vectors in your MATLAB workspace. FDATool uses these vectors to create an IIR lowpass filter with a specified magnitude response curve. Vectors F and A each contain 40 elements, and vectors W and edges contain 40 and 6 elements. If we were not designing
    a specific passband shape, you would not have needed to define these vectors.

  1. Open FDATool by typing fdatool at the command prompt.

  1. FDATool opens in Design Filter mode.

  1. Under Filter Type, select Arbitrary Magnitude from the list.

  1. Although we want a lowpass filter, Lowpass does not let us specify the shape of the passband. So we use the Arbitrary Magnitude option to get precisely the curve we need. You could plot F and A to see that the curve is similar to the response in Figure 1-2. Use the command plot(F,A) to view a simple plot of the specified passband shape.

    When you select Arbitrary Magnitude from the list, the options under Frequency and Magnitude Specifications change to require three vectors: Freq. vector, Mag. vector, and Weight vector.

  1. Continue your IIR filter design by selecting IIR under Design Method, choosing Least Pth-norm from the list.

  1. A new vector appears under Frequency and Magnitude Specifications -- Freq. edges.

  1. Under Frequency and Magnitude Specifications, select Normalized (0 to 1) from the Frequency Units list.
  2. Under Frequency and Magnitude Specifications, enter the variable names that define the four vectors required to specify the filter response.

  1. Freq. vector, Freq. edges, Mag. vector, and Weight vector: F, edges, A, and W.

    Required Vector
    Variable
    Freq. vector
    F
    Freq. edges
    edges
    Mag. vector
    A
    Weight vector
    W

  1. Specify the filter order by entering 8 for the numerator and denominator orders under Filter Order.
  2. Click Design Filter.

  1. FDATool designs the filter and computes the filter response. In the analysis area, you see the magnitude response of the filter displayed on a logarithmic scale.

    In the upper left corner, the plot shows the region of interest for this filter. Click on the FDATool toolbar and use the zoom feature to inspect the filter passband between 0 and 0.05 (as shown in the figure). You see that the shape of the passband for the IIR filter generally matches the shape in Figure 1-2 (accounting for the shift from a linear to a logarithmic y-axis).

    For now, we have an eighth-order, stable filter based on the direct form II transposed structure. It consists of one section.

  1. To see the poles and zeros for the filter, select Pole/Zero Plot from the Analysis menu in FDATool.

  1. For this filter, which is stable, the poles lie on or very close to the unit circle, and close to one another. Generally, when roots are close, they can be sensitive to coefficient quantization effects. Changes to the positions of the poles or zeros could cause the filter to become unstable. This is your first hint that quantizing this double-precision filter might be difficult.


  Getting Started with the Toolbox Quantizing the IIR Filter 

Learn more about the latest releases of MathWorks products:

 © 1994-2009 The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS