Filter Designer is a powerful user interface for designing and analyzing filters. Filter Designer enables you to quickly design digital FIR or IIR filters by setting filter performance specifications, by importing filters from your MATLAB® workspace or by adding, moving, or deleting poles and zeros. Filter Designer also provides tools for analyzing filters, such as magnitude and phase response plots and pole-zero plots. Show
Getting StartedTo open filter designer, type at the MATLAB command prompt.A Tip of the Day dialog displays with suggestions for using Filter Designer. Then, the interface displays with a default filter. The Filter Designer interface has three main regions:
The upper half of the interface displays information on filter specifications and responses for the current filter. The Current Filter Information region, in the upper left, displays filter properties, namely the filter structure, order, number of sections used and whether the filter is stable or not. It also provides access to the Filter manager for working with multiple filters. The Filter Display region, in the upper right, displays various filter responses, such as, magnitude response, group delay and filter coefficients. The lower half of the interface is the interactive portion of Filter Designer. The Design Panel, in the lower half is where you define your filter specifications. It controls what is displayed in the other two upper regions. Other panels can be displayed in the lower half by using the sidebar buttons. The tool includes Context-sensitive help. You can right-click or click the What's This? button to get information on the different parts of the tool. Note that when you open filter designer, Design Filter is not enabled. You must make a change to the default filter design in order to enable Design Filter. This is true for each time you want to change the filter design. Changes to radio button items or drop down menu items such as those under Response Type or Filter Order enable Design Filter immediately. Changes to specifications in text boxes such as Fs, Fpass, and Fstop require you to click outside the text box to enable Design Filter. Choosing a Response TypeYou can choose from several response types:
To design a bandpass filter, select the radio button next to Bandpass in the Response Type region of the app. Note Not all filter design methods are available for all response types. Once you choose your response type, this may restrict the filter design methods available to you. Filter design methods that are not available for a selected response type are removed from the Design Method region of the app. Choosing a Filter Design MethodYou can use the default filter design method for the response type that you've selected, or you can select a filter design method from the available FIR and IIR methods listed in the app. To select the Remez algorithm to compute FIR filter coefficients, select the FIR radio button and choose Setting the Filter Design Specifications
Viewing Filter SpecificationsThe filter design specifications that you can set vary according to response type and design method. The display region illustrates filter specifications when you select > or when you click the Filter Specifications toolbar button. You can also view the filter specifications on the Magnitude plot of a designed filter by selecting > . Filter OrderYou have two mutually exclusive options for determining the filter order when you design an equiripple filter:
Select the Minimum order radio button for this example. Note that filter order specification options depend on the filter design method you choose. Some filter methods may not have both options available. OptionsThe available options depend on the selected filter design method. Only the FIR Equiripple and FIR Window design methods have settable options.
For FIR Equiripple, the option is a Density Factor. See
You can view the window in the Window Visualization Tool (WVTool) by clicking the View button. For this example, set the Density factor to Bandpass Filter Frequency SpecificationsFor a bandpass filter, you can set
You specify the passband with two frequencies. The first frequency determines the lower edge of the passband, and the second frequency determines the upper edge of the passband. Similarly, you specify the stopband with two frequencies. The first frequency determines the upper edge of the first stopband, and the second frequency determines the lower edge of the second stopband. For this example:
Bandpass Filter Magnitude SpecificationsFor a bandpass filter, you can specify the following magnitude response characteristics:
For this example:
Computing the Filter CoefficientsNow that you've specified the filter design, click the Design Filter button to compute the filter coefficients. Notice that the Design Filter button is disabled once you've computed the coefficients for your filter design. This button is enabled again once you make any changes to the filter specifications. Analyzing the Filter
Displaying Filter ResponsesYou can view the following filter response characteristics in the display region or in a separate window.
The and analyses use filter internals. For descriptions of the above responses and their associated toolbar buttons and other filter designer toolbar buttons, see FVTool. You can display two responses in the same plot by selecting > and selecting an available response. A second y-axis is added to the right side of the response plot. (Note that not all responses can be overlaid on each other.) You can also display the filter coefficients and detailed filter information in this region. For all the analysis methods, except zero-phase response, you can access them from the menu, the Analysis Parameters dialog box from the context menu, or by using the toolbar buttons. For zero-phase, right-click the y-axis of the plot and select from the context menu. For example, to look at the filter's magnitude response, select the Magnitude Response button on the toolbar. You can also overlay the filter specifications on the Magnitude plot by selecting > . Note You can use specification masks in FVTool only if FVTool was launched from filter designer. Using Data TipsYou can click the response to add plot data tips that display information about particular points on the response. For information on using data tips, see Interactively Explore Plotted Data. Drawing Spectral MasksTo add spectral masks or rejection area lines to your magnitude plot, click > . The mask is defined by a frequency vector and a magnitude vector. These vectors must be the same length.
The magnitude response below shows a spectral mask. Changing the Sampling FrequencyTo change the sampling frequency of your filter, right-click any filter response plot and select from the context menu. To change the filter name, type the new name in Filter name. (In FVTool, if you have multiple filters, select the desired filter and then enter the new name.) To change the sampling frequency, select the
desired unit from Units and enter the sampling frequency in Fs. (For each filter in To save the displayed parameters as the default values to use when filter designer or FVTool is opened, click Save as Default. To restore the default values, click Restore Original Defaults. Displaying the Response in FVToolTo display the filter response characteristics in a separate window, select > (available if any analysis, except the filter specifications, is in the display region) or click the Full View Analysis button: This launches the Filter Visualization Tool (
Note If Filter Specifications are shown in the display region, clicking the Full View Analysis toolbar button launches a MATLAB figure window instead of FVTool. For details, see Add Annotations to Chart. The associated menu item is , which is enabled only if the filter specifications are displayed. You can use this tool to annotate your design, view other filter characteristics, and print your filter response. You can link filter designer and fvtool so that changes made in filter designer are immediately reflected in fvtool. See FVTool for more information. Editing the Filter Using the Pole/Zero Editor
Displaying the Pole-Zero PlotYou can edit a designed or imported filter's coefficients by moving, deleting, or adding poles and/or zeros using the Pole/Zero Editor panel. Note You cannot generate MATLAB code ( > ) if your filter was designed or edited with the Pole/Zero Editor. You cannot move quantized poles and zeros. You can only move the reference poles and zeros. Click the Pole/Zero Editor button in the sidebar or select > to display this panel. Poles are shown using x symbols and zeros are shown using o symbols. Changing the Pole-Zero PlotPlot mode buttons are located to the left of the pole/zero plot. Select one of the buttons to change the mode of the pole/zero plot. The Pole/Zero Editor has these buttons from left to right: move pole, add pole, add zero, and delete pole or zero. The following plot parameters and controls are located to the left of the pole/zero plot and below the plot mode buttons.
The > has items for selecting multiple poles/zeros, for inverting and mirroring poles/zeros, and for deleting, scaling and rotating poles/zeros. Moving one of the zeros on the vertical axis produces the following result:
Converting the Filter Structure
Converting to a New StructureYou can use > to convert the current filter to a new structure. All filters can be converted to the following representations:
Note If you have DSP System Toolbox™ product installed, you will see additional structures in the Convert structure dialog box. In addition, the following conversions are available for particular classes of filters:
Note Converting from one filter structure to another may produce a result with different characteristics than the original. This is due to the computer's finite-precision arithmetic and the variations in the conversion's roundoff computations. For example:
Converting to Second-Order SectionsYou can use > to store the converted filter structure as a collection of second-order sections rather than as a monolithic higher-order structure. Note The following options are also used for > , which you use to modify an SOS filter structure. The following Scale options are available when converting a direct-form II structure only:
The Direction ( For example:
Exporting a Filter Design
Exporting Coefficients or Objects to the WorkspaceYou can save the filter either as filter coefficients variables or as a filter System object™ variable. To save the filter to the MATLAB workspace:
Exporting Coefficients to an ASCII FileTo save filter coefficients to a text file,
The coefficients are saved in the text file that you specified, and the MATLAB Editor opens to display the file. The text file also contains comments with the MATLAB version number, the Signal Processing Toolbox™ version number, and filter information. Exporting Coefficients or Objects to a MAT-FileTo save filter coefficients or a filter object as variables in a MAT-file:
Exporting to a Simulink ModelIf you have the Simulink® product installed, you can export a Simulink block of your filter design and insert it into a new or existing Simulink model. You can export a filter designed using any filter design method available in the filter designer app. Note If you have the DSP System Toolbox and Fixed-Point Designer™ installed, you can export a CIC filter to a Simulink model.
If you double-click the Simulink Filter block, the filter structure is displayed. Other Ways to Export a FilterYou can also send your filter to a C header file or generate MATLAB code to construct your filter from the command line. For detailed instructions, see the following sections:
Generating a C Header FileYou may want to include filter information in an external C program. To create a C header file with variables that contain filter parameter data, follow this procedure:
Generating MATLAB CodeYou can generate MATLAB code that constructs the filter you designed in filter designer from the command line. Select > > and specify the filename in the Generate MATLAB code dialog box. Note You cannot generate MATLAB code through > > or through > > , if your filter was designed or edited with the Pole/Zero Editor. The following is generated MATLAB code when you choose > > for the equiripple bandpass filter designed in this example. function Hd = ExFilter %EXFILTER Returns a discrete-time filter object. % MATLAB Code % Generated by MATLAB(R) 9.1 and the DSP System Toolbox 9.3. % Generated on: 17-Nov-2016 14:55:28 % Equiripple Bandpass filter designed using the FIRPM function. % All frequency values are in Hz. Fs = 2000; % Sampling Frequency Fstop1 = 200; % First Stopband Frequency Fpass1 = 300; % First Passband Frequency Fpass2 = 700; % Second Passband Frequency Fstop2 = 800; % Second Stopband Frequency Dstop1 = 0.000177827941; % First Stopband Attenuation Dpass = 0.0057563991496; % Passband Ripple Dstop2 = 0.000177827941; % Second Stopband Attenuation dens = 16; % Density Factor % Calculate the order from the parameters using FIRPMORD. [N, Fo, Ao, W] = firpmord([Fstop1 Fpass1 Fpass2 Fstop2]/(Fs/2), [0 1 ... 0], [Dstop1 Dpass Dstop2]); % Calculate the coefficients using the FIRPM function. b = firpm(N, Fo, Ao, W, {dens}); Hd = dsp.FIRFilter( ... 'Numerator', b); % [EOF] Managing Filters in the Current SessionYou can store filters designed in the current filter designer session for cascading together, exporting to FVTool or for recalling later in the same or future filter designer sessions. You store and access saved filters with the Store filter and Filter Manager buttons, respectively, in the Current Filter Information pane. Store Filter — Displays the Store Filter dialog box in which you specify the filter name to use when storing the filter in the Filter Manager. The default name is the type of the filter. Filter Manager — Opens the Filter Manager. The current filter is listed below the listbox. To change the current filter, highlight the desired filter. If you select Edit current filter, filter designer displays the currently selected filter specifications. If you make any changes to the specifications, the stored filter is updated immediately. To cascade two or more filters, highlight the desired filters and press Cascade. A new cascaded filter is added to the Filter Manager. To change the name of a stored filter, press Rename. The Rename filter dialog box is displayed. To remove a stored filter from the Filter Manager, press Delete. To export one or more filters to FVTool, highlight the filter(s) and press FVTool. Saving and Opening Filter Design SessionsYou can save your filter design session as a MAT-file and return to the same session another time. Select the button to save your session as a MAT-file. The first time you save a session, a Save Filter Design Session browser opens, prompting you for a session name. For example, save this design session as The Note You can also use the > and > to save a session. You can load existing sessions into the Filter Design and Analysis Tool by selecting the Open session button, Open session button, or > . A Load Filter Design Session browser opens that allows you to select from your previously saved filter design sessions. Related Topics
Which of the following is used to locate data in a database?Indexes are used to quickly locate data without having to search every row in a database table every time a database table is accessed.
Which of the following should you add into a query to search for records that meet a specific value?Which of the following should you add to a query to search for records that meet a specific value? You can add criterion into a query to search for specific records.
What is the most efficient way to navigate to the last record in a table?What is the most efficient way to navigate to the last record in a table containing 100 records? Use the Last record button on the navigation bar.
Which of the following is not an example of an access object?Expert-Verified Answer. From the following Database is not an MS Access object,((Option d.) MS Access makes use of "objects" to assist users list and organise information and create custom reports. Tables, Queries, Forms, Reports, Macros, and Modules are the most common items in Access databases.
|