Appendix Data Base Control
Appendix Data Base Control
Introduction
This section describes how to graphically design and implement digital
filters using the Signal Processing Toolbox™ FDATool GUI. Filter design
is the process of creating the filter coefficients to meet specific frequency
specifications. Filter implementation involves choosing and applying a
particular filter structure to those coefficients. Only after both design and
implementation have been performed can your data be filtered.
Although many methods exist for designing the filter coefficients, this chapter
focuses on using the basic features of the Filter Design and Analysis Tool
(FDATool) GUI. For filter implementation, this chapter uses dfilt.
This section includes a brief discussion of applying the completed filter design
and filter implementation using MATLAB® command line functions, such as
filter.
3-2
Designing the Filter
fdatool
The FDATool dialog opens with a default filter. Its filter information is
summarized in the upper left (Current Filter Information) and its filter
specifications are depicted in the upper right. In addition to displaying
filter specification, this upper right pane displays filter responses and filter
coefficients.
3-3
3 Filter Design with the FDATool GUI
The bottom half of FDATool shows the Filter Design panel, where you
specify the filter parameters. Other panels, such as Import filter from
workspace and Pole/Zero Editor, which you access with the buttons on
the lower left, are also displayed in this area. If you have other products
installed, you may see additional buttons.
3 In the Design Method pane, select IIR, and then select Butterworth
from the selection list.
3-4
Designing the Filter
4 For the Filter Order, select Specify order, and then enter 6.
3-5
3 Filter Design with the FDATool GUI
6 After specifying the filter design parameters, click the Design Filter
button at the bottom of the design panel to compute the filter coefficients.
The display updates to show the magnitude response of the designed filter.
Notice that the Design Filter button is disabled after you compute the
coefficients for your filter design. This button is enabled again if you make
any changes to the filter specifications.
3-6
Designing the Filter
3-7
3 Filter Design with the FDATool GUI
Phase response
Group delay
Phase delay
Impulse response
Step response
Pole-zero plot
Filter coefficients
Filter information
3-8
Analyzing the Filter
Note Other analyses are available if you have the Filter Design Toolbox™
product installed.
3-9
3 Filter Design with the FDATool GUI
1 Using the parameters listed in the table above, for each table row, set the
appropriate the Fc1 and Fc2 values.
4 Change the name to the appropriate filter name shown in the table above.
5 Repeat these steps until all 10 filters are designed and stored.
3-10
Viewing and Annotating the Filter
1 Click the Filter Manager button to display the Filter Manager, which
lists your saved filters.
2 Press Ctrl+click on each filter name to select all the filters, and then
click FVTool. FVTool opens with the filter responses overlaid for easy
comparison. (If you want to view a single filter in FVTool, click the Full
3-11
3 Filter Design with the FDATool GUI
View Analysis button when that filter is shown in the FDATool display
panel or select View > Filter Visualization Tool).
5 Click OK.
3-12
Viewing and Annotating the Filter
6 Click the Legend button to turn on the legend, which you can drag to
the desired location.
3-13
3 Filter Design with the FDATool GUI
Use the Zoom button and drag a rectangle around the first few
passbands to zoom in.
3-14
Viewing and Annotating the Filter
8 Click the Restore Default View button to return to the full view.
For a demo about FVTool, type demos at the MATLAB® command line,
and select Toolboxes. Expand the tree, scroll down, and select Signal
Processing Toolbox. Under Filter Design and Analysis, click Filter
Analysis using FVTool and its API.
3-15
3 Filter Design with the FDATool GUI
Note Do not close FDATool at this time. You will use it in future sections.
1 Use the toolbar buttons to annotate your response plot. Add a line by
clicking one of the line buttons, and then use your mouse to draw the line
on your plot.
2 Add a data maker by clicking on a plot at the desired point. The data
marker shows the frequency and magnitude at that point.
3-16
Exporting Filters from FDATool
4 Repeat steps 1 through 3 for each of the remaining nine filters. Highlight
each filter individually to make it the active filter and change the Discrete
Filter name to match the filter number. When you finish you will have
10 dfilt objects in the workspace.
3-17
3 Filter Design with the FDATool GUI
6 On the MATLAB command line, verify that your objects were exported by
using the whos command.
whos
Name Size Bytes Class Attributes
3-18
Using Discrete Filter Objects (dfilts)
For an interactive demo about dfilts, type demos at the MATLAB® command
line, and select Toolboxes. Expand the tree, scroll down, and select Signal
Processing Toolbox. Under Filter Design and Analysis, click Getting
Started with Discrete-Time Filter Objects.
Hd = [Hd1 Hd2 Hd3 Hd4 Hd5 Hd6 Hd7 Hd8 Hd9 Hd10];
Hd(1)
ans =
FilterStructure: 'Direct-Form II, Second-Order Sections'
sosMatrix: [3x6 double]
ScaleValues: [3.40097054256801e-009;1;1;1]
PersistentMemory: false
3 A number of methods can be used to view and manipulate the Hd1 dfilt
object. Try the info command:
3-19
3 Filter Design with the FDATool GUI
4 You can open FVTool from the MATLAB command line and specify display
parameters as follows.
This produces the same display as step 5 of “Viewing the Filter in FVTool”
on page 3-11 above.
5 Now using the MATLAB command line, create some discrete white
Gaussian noise data, which you can then filter using the filter bank.
Note Do not delete this filtered data. You will use it in the Spectral
Analysis section.
plot(yw)
3-20
Using Discrete Filter Objects (dfilts)
The next section discusses spectral analysis, where you analyze this data.
3-21
3 Filter Design with the FDATool GUI
3-22