DSP System Toolbox™ software adds new dialog boxes and operating modes, and new menu selections, to the filter designer provided by Signal Processing Toolbox™ software. From the additional dialog boxes, one titled Set Quantization Parameters and one titled Frequency Transformations, you can:
Design advanced filters that Signal Processing Toolbox software does not provide the design tools to develop.
View Simulink^{®} models of the filter structures available in the toolbox.
Quantize doubleprecision filters you design in this app using the design mode.
Quantize doubleprecision filters you import into this app using the import mode.
Analyze quantized filters.
Scale secondorder section filters.
Select the quantization settings for the properties of the quantized filter displayed by the tool:
Coefficients — select the quantization options applied to the filter coefficients
Input/output — control how the filter processes input and output data
Filter Internals — specify how the arithmetic for the filter behaves
Design multirate filters.
Transform both FIR and IIR filters from one response to another.
After you import a filter into filter designer, the options on the quantization dialog box let you quantize the filter and investigate the effects of various quantization settings.
Options in the frequency transformations dialog box let you change the frequency response of your filter, keeping various important features while changing the response shape.
Adding DSP System Toolbox software to your tool suite adds a number of filter design techniques to filter designer. Use the new filter responses to develop filters that meet more complex requirements than those you can design in Signal Processing Toolbox software. While the designs in filter designer are available as command line functions, the graphical user interface of filter designer makes the design process more clear and easier to accomplish.
As you select a response type, the options in the right panes in filter designer change to let you set the values that define your filter. You also see that the analysis area includes a diagram (called a design mask) that describes the options for the filter response you choose.
By reviewing the mask you can see how the options are defined and how to use them. While this is usually straightforward for lowpass or highpass filter responses, setting the options for the arbitrary response types or the peaking/notching filters is more complicated. Having the masks leads you to your result more easily.
Changing the filter design method changes the available response type options. Similarly, the response type you select may change the filter design methods you can choose.
Notch filters aim to remove one or a few frequencies from a broader spectrum. You must specify the frequencies to remove by setting the filter design options in filter designer appropriately:
Response Type
Design Method
Frequency Specifications
Magnitude Specifications
Here is how you design a notch filter that removes concert A (440 Hz) from an input musical signal spectrum.
Select Notching
from the Differentiator list in Response
Type.
Select IIR in Filter Design Method and choose Single
Notch
from the list.
For the Frequency
Specifications, set Units to
Hz
and Fs, the full scale
frequency, to 1000
.
Set the location of the center of the notch, in either
normalized frequency or Hz. For the notch center at 440 Hz, enter
440
.
To shape the notch, enter the bandwidth, bw
, to be 40
.
Leave the Magnitude
Specification in dB
(the default) and leave Apass as 1
.
Click Design Filter.
filter designer computes the filter coefficients and plots the filter magnitude response in the analysis area for you to review.
When you design a single notch filter, you do not have the option of setting the filter order — the Filter Order options are disabled.
Your filter should look about like this:
For more information about a design method, refer to the online Help system. For instance, to get further information about the Q setting for the notch filter in filter designer, enter
doc iirnotch
at the command line. This opens the Help browser and displays the reference page for
function iirnotch
.
Designing other filters follows a similar procedure, adjusting for different design specification options as each design requires.
Any one of the designs may be quantized in filter designer and analyzed with the available analyses on the Analysis menu.
You use the quantization panel in filter designer to quantize filters. Quantization represents the fourth operating mode for filter designer, along with the filter design, filter transformation, and import modes. To switch to quantization mode, open filter designer from the MATLAB^{®} command prompt by entering
filterDesigner
When filter designer opens, click the Set Quantization Parameters button on the side bar. Filter designer switches to quantization mode and you see the following panel at the bottom of filter designer, with the default doubleprecision option shown for Filter arithmetic.
The Filter arithmetic option lets you quantize filters
and investigate the effects of changing quantization settings. To enable the quantization
settings in filter designer, select Fixedpoint
from the Filter Arithmetic.
The quantization options appear in the lower panel of filter designer. You see tabs that access various sets of options for quantizing your filter.
You use the following tabs in the dialog box to perform tasks related to quantizing filters in filter designer:
Coefficients provides access the settings for defining the coefficient quantization. This is the default active panel when you switch filter designer to quantization mode without a quantized filter in the tool. When you import a fixedpoint filter into filter designer, this is the active pane when you switch to quantization mode.
Input/Output switches filter designer to the options for quantizing the inputs and outputs for your filter.
Filter Internals lets you set a variety of options for the arithmetic your filter performs, such as how the filter handles the results of multiplication operations or how the filter uses the accumulator.
Apply — applies changes you make to the quantization parameters for your filter.
Quantized filters have properties that define how they quantize data you filter. Use the Set Quantization Parameters dialog box in filter designer to set the properties. Using options in the Set Quantization Parameters dialog box, filter designer lets you perform a number of tasks:
Create a quantized filter from a doubleprecision filter after either importing the filter from your workspace, or using filter designer to design the prototype filter.
Create a quantized filter that has the default structure (Direct form II transposed) or any structure you choose, and other property values you select.
Change the quantization property values for a quantized filter after you design the filter or import it from your workspace.
When you click Set Quantization Parameters, and then change
Filter arithmetic to Fixedpoint
,
the quantized filter panel opens in filter designer, with the coefficient quantization
options set to default values.
To let you set the properties for the filter coefficients that make up your quantized filter, filter designer lists options for numerator word length (and denominator word length if you have an IIR filter). The following table lists each coefficients option and a short description of what the option setting does in the filter.
Option Name  When Used  Description 

Numerator Word Length  FIR filters only  Sets the word length used to represent numerator coefficients in FIR filters. 
Numerator Frac. Length  FIR/IIR  Sets the fraction length used to interpret numerator coefficients in FIR filters. 
Numerator Range (+/)  FIR/IIR  Lets you set the range the numerators represent. You use this instead of the Numerator Frac. Length option to set the precision. When you enter a value x, the resulting range is x to x. Range must be a positive integer. 
Coefficient Word Length  IIR filters only  Sets the word length used to represent both numerator and denominator coefficients in IIR filters. You cannot set different word lengths for the numerator and denominator coefficients. 
Denominator Frac. Length  IIR filters  Sets the fraction length used to interpret denominator coefficients in IIR filters. 
Denominator Range (+/)  IIR filters  Lets you set the range the denominator coefficients represent. You use this instead of the Denominator Frac. Length option to set the precision. When you enter a value x, the resulting range is x to x. Range must be a positive integer. 
Bestprecision fraction lengths  All filters  Directs filter designer to select the fraction lengths for numerator (and denominator where available) values to maximize the filter performance. Selecting this option disables all of the fraction length options for the filter. 
Scale Values frac. length  SOS IIR filters  Sets the fraction length used to interpret the scale values in SOS filters. 
Scale Values range (+/)  SOS IIR filters  Lets you set the range the SOS scale values represent. You use this with SOS filters to adjust the scaling used between filter sections. Setting this value disables the Scale Values frac. length option. When you enter a value x, the resulting range is x to x. Range must be a positive integer. 
Use unsigned representation  All filters  Tells filter designer to interpret the coefficients as unsigned values. 
Scale the numerator coefficients to fully utilize the entire dynamic range  All filters  Directs filter designer to scale the numerator coefficients to effectively use the dynamic range defined by the numerator word length and fraction length format. 
The options that specify how the quantized filter uses input and output values are listed in the table below.
Option Name  When Used  Description 

Input Word Length  All filters  Sets the word length used to represent the input to a filter. 
Input fraction length  All filters  Sets the fraction length used to interpret input values to filter. 
Input range (+/)  All filters  Lets you set the range the inputs represent. You use this instead of the Input fraction length option to set the precision. When you enter a value x, the resulting range is x to x. Range must be a positive integer. 
Output word length  All filters  Sets the word length used to represent the output from a filter. 
Avoid overflow  All filters  Directs the filter to set the fraction length for the input to prevent the output values from exceeding the available range as defined by the word length. Clearing this option lets you set Output fraction length. 
Output fraction length  All filters  Sets the fraction length used to represent output values from a filter. 
Output range (+/)  All filters  Lets you set the range the outputs represent. You use this instead of the Output fraction length option to set the precision. When you enter a value x, the resulting range is x to x. Range must be a positive integer. 
Stage input word length  SOS filters only  Sets the word length used to represent the input to an SOS filter section. 
Avoid overflow  SOS filters only  Directs the filter to use a fraction length for stage inputs that prevents overflows in the values. When you clear this option, you can set Stage input fraction length. 
Stage input fraction length  SOS filters only  Sets the fraction length used to represent input to a section of an SOS filter. 
Stage output word length  SOS filters only  Sets the word length used to represent the output from an SOS filter section. 
Avoid overflow  SOS filters only  Directs the filter to use a fraction length for stage outputs that prevents overflows in the values. When you clear this option, you can set Stage output fraction length. 
Stage output fraction length  SOS filters only  Sets the fraction length used to represent the output from a section of an SOS filter. 
The options that specify how the quantized filter performs arithmetic operations are listed in the table below.
Option  Equivalent Filter Property (Using Wildcard *)  Description 

Round towards 
 Sets the mode the filter uses to quantize numeric values when the values lie between representable values for the data format (word and fraction lengths). Choose from one of:

Overflow Mode 
 Sets the mode used to respond to overflow conditions in fixedpoint
arithmetic. Choose from either 
Filter Product (Multiply) Options  
Product Mode 
 Determines how the filter handles the output of product operations.
Choose from full precision ( 
Product word length 
 Sets the word length applied to interpret the results of multiply operations. 
Num. fraction length 
 Sets the fraction length used to interpret the results of product operations that involve numerator coefficients. 
Den. fraction length 
 Sets the fraction length used to interpret the results of product operations that involve denominator coefficients. 
Filter Sum Options  
Accum. mode 
 Determines how the accumulator outputs stored values. Choose from full
precision ( 
Accum. word length 
 Sets the word length used to store data in the accumulator/buffer. 
Num. fraction length 
 Sets the fraction length used to interpret the numerator coefficients. 
Den. fraction length 
 Sets the fraction length the filter uses to interpret denominator coefficients. 
Cast signals before sum 
 Specifies whether to cast numeric data to the appropriate accumulator format (as shown in the signal flow diagrams for each filter structure) before performing sum operations. 
Filter State Options  
State word length 
 Sets the word length used to represent the filter states. Applied to both numerator and denominatorrelated states 
Avoid overflow  None  Prevent overflows in arithmetic calculations by setting the fraction length appropriately. 
State fraction length 
 Lets you set the fraction length applied to interpret the filter states. Applied to both numerator and denominatorrelated states 
When you apply changes to the values in the Filter Internals pane, the plots for the Magnitude response estimate and Roundoff noise power spectrum analyses update to reflect those changes. Other types of analyses are not affected by changes to the values in the Filter Internals pane.
CIC filters use slightly different options for specifying the fixedpoint arithmetic in the filter. The next table shows and describes the options.
Quantize DoublePrecision Filters. When you are quantizing a doubleprecision filter by switching to fixedpoint or singleprecision floating point arithmetic, follow these steps.
Click Set Quantization Parameters to display the Set Quantization Parameters pane in filter designer.
Select Singleprecision floating point
or
Fixedpoint
from Filter
arithmetic.
When you select one of the optional arithmetic settings, filter designer quantizes the current filter according to the settings of the options in the Set Quantization Parameter panes, and changes the information displayed in the analysis area to show quantized filter data.
In the quantization panes, set the options for your filter. Set options for Coefficients, Input/Output, and Filter Internals.
Click Apply.
Filter designer quantizes your filter using your new settings.
Use the analysis features in filter designer to determine whether your new quantized filter meets your requirements.
Change the Quantization Properties of Quantized Filters. When you are changing the settings for the quantization of a quantized filter, or after you import a quantized filter from your MATLAB workspace, follow these steps to set the property values for the filter:
Verify that the current filter is quantized.
Click Set Quantization Parameters to display the Set Quantization Parameters panel.
Review and select property settings for the filter quantization: Coefficients, Input/Output, and Filter Internals. Settings for options on these panes determine how your filter quantizes data during filtering operations.
Click Apply to update your current quantized filter to use the new quantization property settings from Step 3.
Use the analysis features in filter designer to determine whether your new quantized filter meets your requirements.
After you design and quantize your filter, the Magnitude Response Estimate option on the Analysis menu lets you apply the noise loading method to your filter. When you select Analysis > Magnitude Response Estimate from the menu bar, filter designer immediately starts the Monte Carlo trials that form the basis for the method and runs the analysis, ending by displaying the results in the analysis area in filter designer.
With the noisebased method, you estimate the complex frequency response for your filter as determined by applying a noise like signal to the filter input. Magnitude Response Estimate uses the Monte Carlo trials to generate a noise signal that contains complete frequency content across the range 0 to Fs. The first time you run the analysis, magnitude response estimate uses default settings for the various conditions that define the process, such as the number of test points and the number of trials.
Analysis Parameter  Default Setting  Description 

Number of Points 
 Number of equally spaced points around the upper half of the unit circle. 
Frequency Range 
 Frequency range of the plot xaxis. 
Frequency Units 
 Units for specifying the frequency range. 
Sampling Frequency 
 Inverse of the sampling period. 
Frequency Scale 
 Units used for the yaxis display of the output. 
Normalized Frequency 
 Use normalized frequency for the display. 
After your first analysis run ends, open the Analysis Parameters dialog box and adjust your settings appropriately, such as changing the number of trials or number of points.
To open the Analysis Parameters dialog box, use either of the next procedures when you have a quantized filter in filter designer:
Select Analysis > Analysis Parameters from the menu bar
Rightclick in the filter analysis area and select Analysis Parameters from the context menu
Whichever option you choose opens the dialog box. Notice that the settings for the options reflect the defaults.
Noise Method Applied to a Filter. To demonstrate the magnitude response estimate method, start by creating a quantized filter. For this example, use filter designer to design a sixthorder Butterworth IIR filter.
To Use NoiseBased Analysis in Filter Designer
Enter filterDesigner
at the MATLAB prompt to launch filter designer.
Under Response Type, select Highpass.
Select IIR
in Design
Method. Then select Butterworth
.
To set the filter order to 6, select Specify order under Filter Order.
Enter 6
in the text box.
Click Design Filter.
In filter designer, the analysis area changes to display the magnitude response for your filter.
To generate the quantized version of your filter, using default quantizer settings, click on the side bar.
Filter designer switches to quantization mode and displays the quantization panel.
From Filter arithmetic,
select fixedpoint
.
Now the analysis areas shows the magnitude response for both filters — your original filter and the fixedpoint arithmetic version.
Finally, to use noisebased estimation on your quantized filter, select Analysis > Magnitude Response Estimate from the menu bar.
Filter designer runs the trial, calculates the estimated magnitude response for the filter, and displays the result in the analysis area as shown in this figure.
In the above figure you see the magnitude response as estimated by the analysis method.
View the Noise Power Spectrum. When you use the noise method to estimate the magnitude response of a filter, filter designer simulates and applies a spectrum of noise values to test your filter response. While the simulated noise is essentially white, you might want to see the actual spectrum that filter designer used to test your filter.
From the Analysis menu bar option, select Roundoff Noise Power Spectrum. In the analysis area in filter designer, you see the spectrum of the noise used to estimate the filter response. The details of the noise spectrum, such as the range and number of data points, appear in the Analysis Parameters dialog box.
For more information, refer to McClellan, et al., ComputerBased Exercises for Signal Processing Using MATLAB 5, PrenticeHall, 1998. See Project 5: Quantization Noise in Digital Filters, page 231.
Change Your Noise Analysis Parameters. In Noise Method Applied to a Filter, you used synthetic white noise to estimate the magnitude response for a fixedpoint highpass Butterworth filter. Since you ran the estimate only once in filter designer, your noise analysis used the default analysis parameters settings shown in Analyze Filters with the Magnitude Response Estimate Method.
To change the settings, follow these steps after the first time you use the noise estimate on your quantized filter.
With the results from running the noise estimating method displayed in the filter designer analysis area, select Analysis > Analysis Parameters from the menu bar.
To give you access to the analysis parameters, the Analysis Parameters dialog box opens (with default settings).
To use more points in the spectrum to estimate the magnitude
response, change Number of Points to
1024
and click OK to run the
analysis.
Filter designer closes the Analysis Parameters dialog box and reruns the noise estimate, returning the results in the analysis area.
To rerun the test without closing the dialog box, press Enter after you type your new value into a setting, then click Apply. Now filter designer runs the test without closing the dialog box. When you want to try many different settings for the noisebased analysis, this is a useful shortcut.
An important measure of the effectiveness of the noise method for estimating the magnitude response of a quantized filter is to compare the estimated response to the theoretical response.
One way to do this comparison is to overlay the theoretical response on the estimated response. While you have the Magnitude Response Estimate displaying in filter designer, select Analysis > Overlay Analysis from the menu bar. Then select Magnitude Response to show both response curves plotted together in the analysis area.
Filter designer lets you change the structure of any quantized filter. Use the Convert structure option to change the structure of your filter to one that meets your needs.
To learn about changing the structure of a filter in filter designer, refer to Converting the Filter Structure.
You use the Convert structure option to change the structure of filter. When the Source is Designed(Quantized) or Imported(Quantized), Convert structure lets you recast the filter to one of the following structures:
Starting from any quantized filter, you can convert to one of the following representation:
Direct form I
Direct form II
Direct form I transposed
Direct form II transposed
Lattice ARMA
Additionally, filter designer lets you do the following conversions:
Minimum phase FIR filter to Lattice MA minimum phase
Maximum phase FIR filter to Lattice MA maximum phase
Allpass filters to Lattice allpass
Refer to FilterStructure for details about each of these structures.
To learn about using filter designer to convert your quantized filter to use secondorder sections, refer to Converting to SecondOrder Sections. You might notice that filters you design in filter designer, rather than filters you imported, are implemented in SOS form.
View Filter Structures in Filter Designer. To open the demonstration, click Help > Show filter structures. After the Help browser opens, you see the reference page for the current filter. You find the filter structure signal flow diagram on this reference page, or you can navigate to reference pages for other filter.
Filter designer provides the ability to scale SOS filters after you create them. Using options on the Reordering and Scaling SecondOrder Sections dialog box, filter designer scales either or both the filter numerators and filter scale values according to your choices for the scaling options.
Parameter  Description and Valid Value 

Scale  Apply any scaling options to the filter. Select this when you are reordering your SOS filter and you want to scale it at the same time. Or when you are scaling your filter, with or without reordering. Scaling is disabled by default. 
No Overflow — High SNR slider  Lets you set whether scaling favors reducing arithmetic overflow in the
filter or maximizing the signaltonoise ratio (SNR) at the filter output.
Moving the slider to the right increases the emphasis on SNR at the expense of
possible overflows. The markings indicate the Pnorm applied to achieve the
desired result in SNR or overflow protection. For more information about the
Pnorm settings, refer to 
Maximum Numerator  Maximum allowed value for numerator coefficients after scaling. 
Numerator Constraint  Specifies whether and how to constrain numerator coefficient values.
Options are 
Overflow Mode  Sets the way the filter handles arithmetic overflow situations during
scaling. Choose from either 
Scale Value Constraint  Specify whether to constrain the filter scale values, and how to
constrain them. Valid options are 
Max. Scale Value  Sets the maximum allowed scale values. SOS filter scaling applies the
Max. Scale Value limit only when you set
Scale Value Constraint to a value other than

Revert to Original Filter  Returns your filter to the original scaling. Being able to revert to your original filter makes it easier to assess the results of scaling your filter. 
Various combinations of settings let you scale filter numerators without changing the scale values, or adjust the filter scale values without changing the numerators. There is no scaling control for denominators.
Start the process by designing a lowpass elliptical filter in filter designer.
Launch filter designer.
In Response Type, select Lowpass.
In Design Method, select IIR
and Elliptic
from the IIR design methods list.
Select Minimum Order for the filter.
Switch the frequency units by choosing Normalized(0 to
1)
from the Units list.
To set the passband specifications, enter
0.45
for wpass and
0.55
for wstop. Finally, in
Magnitude Specifications, set Astop to 60
.
Click Design Filter to design the filter.
After filter designer finishes designing the filter, you see the following plot and settings in the tool.
You kept the Options setting for Match exactly as both
, meaning the filter
design matches the specification for the passband and the stopband.
To switch to scaling the filter, select Edit > Reorder and Scale SecondOrder Sections from the menu bar.
To see the filter coefficients, return to filter designer and select Filter Coefficients from the Analysis menu. Filter designer displays the coefficients and scale values in filter designer.
With the coefficients displayed you can see the effects of scaling your filter directly in the scale values and filter coefficients.
Now try scaling the filter in a few different ways. First scale the filter to maximize the SNR.
Return to the Reordering and Scaling SecondOrder Sections dialog box and select None for Reordering in the left pane. This prevents filter designer from reordering the filter sections when you rescale the filter.
Move the No Overflow—High SNR slider from No Overflow to High SNR.
Click Apply to scale the filter and leave the dialog box open.
After a few moments, filter designer updates the coefficients displayed so you see the new scaling.
All of the scale factors are now 1
, and the SOS matrix of
coefficients shows that none of the numerator coefficients are 1
and the first denominator coefficient of each section is 1
.
Click Revert to Original Filter to restore the filter to the original settings for scaling and coefficients.
Filter Designer designs most discretetime filters in secondorder sections. Generally, SOS filters resist the effects of quantization changes when you create fixedpoint filters. After you have a secondorder section filter in filter designer, either one you designed in the tool, or one you imported, filter designer provides the capability to change the order of the sections that compose the filter. Any SOS filter in filter designer allows reordering of the sections.
To reorder the sections of a filter, you access the Reorder and Scaling of SecondOrder Sections dialog box in filter designer.
With your SOS filter in filter designer, select Edit > Reorder and Scale from the menu bar. filter designer returns the reordering dialog box shown here with the default settings.
Controls on the Reordering and Scaling of SecondOrder Sections dialog box
In this dialog box, the lefthand side contains options for reordering SOS filters. On
the right you see the scaling options. These are independent — reordering your
filter does not require scaling (note the Scale option)
and scaling does not require that you reorder your filter (note the None option under Reordering). For more
about scaling SOS filters, refer to Scale SecondOrder Section Filters and to scale
in the reference section.
Reordering SOS filters involves using the options in the Reordering and Scaling of SecondOrder Sections dialog box. The following table lists each reorder option and provides a description of what the option does.
Control Option  Description 

Auto  Reorders the filter sections to minimize the output noise power of the filter. Note that different ordering applies to each specification type, such as lowpass or highpass. Automatic ordering adapts to the specification type of your filter. 
None  Does no reordering on your filter. Selecting None lets you scale your filter without applying reordering at the same time. When you access this dialog box with a current filter, this is the default setting — no reordering is applied. 
Least selective section to most selective section  Rearranges the filter sections so the least restrictive (lowest Q) section is the first section and the most restrictive (highest Q) section is the last section. 
Most selective section to least selective section  Rearranges the filter sections so the most restrictive (highest Q) section is the first section and the least restrictive (lowest Q) section is the last section. 
Custom reordering  Lets you specify the section ordering to use by enabling the Numerator Order and Denominator Order options 
Numerator Order  Specify new ordering for the sections of your SOS filter. Enter a vector of the indices of the sections in the order in which to rearrange them. For example, a filter with five sections has indices 1, 2, 3, 4, and 5. To switch the second and fourth sections, the vector would be [1,4,3,2,5]. 
Use Numerator Order  Rearranges the denominators in the order assigned to the numerators. 
Specify  Lets you specify the order of the denominators, rather than using the numerator order. Enter a vector of the indices of the sections to specify the order of the denominators to use. For example, a filter with five sections has indices 1, 2, 3, 4, and 5. To switch the second and fourth sections, the vector would be [1,4,3,2,5]. 
Use Numerator Order  Reorders the scale values according to the order of the numerators. 
Specify  Lets you specify the order of the scale values, rather than using the numerator order. Enter a vector of the indices of the sections to specify the order of the denominators to use. For example, a filter with five sections has indices 1, 2, 3, 4, and 5. To switch the second and fourth sections, the vector would be [1,4,3,2,5]. 
Revert to Original Filter  Returns your filter to the original section ordering. Being able to revert to your original filter makes comparing the results of changing the order of the sections easier to assess. 
Reorder an SOS Filter. With filter designer open a secondorder filter as the current filter, you use the following process to access the reordering capability and reorder you filter. Start by launching filter designer from the command prompt.
Enter filterDesigner
at the command prompt
to launch filter designer.
Design a lowpass Butterworth filter with order 10 and the default frequency specifications by entering the following settings:
Under Response Type select
Lowpass
.
Under Design Method, select IIR and Butterworth
from the list.
Specify the order equal to 10 in Specify order under Filter Order.
Keep the default Fs and Fc values in Frequency Specifications.
Click Design Filter.
Filter designer designs the Butterworth filter and returns your filter as a DirectForm II filter implemented with secondorder sections. You see the specifications in the Current Filter Information area.
With the secondorder filter in filter designer, reordering the filter uses the
Reordering and Scaling of SecondOrder Sections
feature in filter designer (also available in Filter Visualization Tool, fvtool
).
To reorder your filter, select Edit > Reorder and Scale SecondOrder Sections from the filter designer menus.
Now you are ready to reorder the sections of your filter. Note that filter designer performs the reordering on the current filter in the session.
Use Least Selective to Most Selective Section Reordering. To let filter designer reorder your filter so the least selective section is first and the most selective section is last, perform the following steps in the Reordering and Scaling of SecondOrder Sections dialog box.
In Reordering, select Least selective section to most selective section.
To prevent filter scaling at the same time, clear Scale in Scaling.
In filter designer, select View > SOS View Settings from the menu bar so you see the sections of your filter displayed in filter designer.
In the SOS View Settings dialog box, select Individual sections. Making this choice configures filter designer to show the magnitude response curves for each section of your filter in the analysis area.
Back in the Reordering and Scaling of SecondOrder Sections dialog box, click Apply to reorder your filter according to the Qs of the filter sections, and keep the dialog box open. In response, filter designer presents the responses for each filter section (there should be five sections) in the analysis area.
In the next two figures you can compare the ordering of the sections of your filter. In the first figure, your original filter sections appear. In the second figure, the sections have been rearranged from least selective to most selective.
You see what reordering does, although the result is a bit subtle. Now try custom reordering the sections of your filter or using the most selective to least selective reordering option.
Since you can design and reorder the sections of SOS filters, filter designer provides the ability to view the filter sections in the analysis area — SOS View. Once you have a secondorder section filter as your current filter in filter designer, you turn on the SOS View option to see the filter sections individually, or cumulatively, or even only some of the sections. Enabling SOS View puts filter designer in a mode where all secondorder section filters display sections until you disable the SOS View option. SOS View mode applies to any analysis you display in the analysis area. For example, if you configure filter designer to show the phase responses for filters, enabling SOS View means filter designer displays the phase response for each section of SOS filters.
Controls on the SOS View Dialog Box
SOS View uses a few options to control how filter designer displays the sections, or which sections to display. When you select View > SOS View from the filter designer menu bar, you see this dialog box containing options to configure SOS View operation.
By default, SOS View shows the overall response of SOS filters. Options in the SOS View dialog box let you change the display. This table lists all the options and describes the effects of each.
Option  Description 

Overall Filter  This is the familiar display in filter designer. For a secondorder section filter you see only the overall response rather than the responses for the individual sections. This is the default configuration. 
Individual sections  When you select this option, filter designer displays the response for each section as a curve. If your filter has five sections you see five response curves, one for each section, and they are independent. Compare to Cumulative sections. 
Cumulative sections  When you select this option, filter designer displays the response for each section as the accumulated response of all prior sections in the filter. If your filter has five sections you see five response curves:
And so on until all filter sections appear in the display. The final curve represents the overall filter response. Compare to Cumulative sections and Overall Filter. 
User defined  Here you define which sections to display, and in which order. Selecting this option enables the text box where you enter a cell array of the indices of the filter sections. Each index represents one section. Entering one index plots one response. Entering something like {1:2} plots the combined response of sections 1 and 2. If you have a filter with four sections, the entry {1:4} plots the combined response for all four sections, whereas {1,2,3,4} plots the response for each section. Note that after you enter the cell array, you need to click OK or Apply to update the filter designer analysis area to the new SOS View configuration. 
Use secondaryscaling points  This directs filter designer to use the secondary scaling points in the
sections to determine where to split the sections. This option applies only when
the filter is a 
After you design or import an SOS filter in to filter designer, the SOS view option lets you see the per section performance of your filter. Enabling SOS View from the View menu in filter designer configures the tool to display the sections of SOS filters whenever the current filter is an SOS filter.
These next steps demonstrate using SOS View to see your filter sections displayed in filter designer.
Launch filter designer.
Create a lowpass SOS filter using the Butterworth design method. Specify the filter order to be 6. Using a low order filter makes seeing the sections more clear.
Design your new filter by clicking Design Filter.
filter designer design your filter and show you the magnitude response in the analysis area. In Current Filter Information you see the specifications for your filter. You should have a sixthorder DirectForm II, SecondOrder Sections filter with three sections.
To enable SOS View, select View > SOS View from the menu bar.
By default the analysis area in filter designer shows the overall filter response, not the individual filter section responses. This dialog box lets you change the display configuration to see the sections.
To see the magnitude responses for each filter section, select Individual sections.
Click Apply to update filter designer to display the responses for each filter section. The analysis area changes to show you something like the following figure.
If you switch filter designer to display filter phase responses (by selecting Analysis > Phase Response), you see the phase response for each filter section in the analysis area.
To define your own display of the sections, you use the User defined option and enter a vector of section indices to display. Now you see a display of the first section response, and the cumulative first, second, and third sections response:
Select User defined to enable the text entry box in the dialog box.
Enter the cell array {1,1:3}
to specify that filter
designer should display the response of the first section and the cumulative
response of the first three sections of the filter.
To apply your new SOS View selection, click Apply or OK (which closes the SOS View dialog box).
In the filter designer analysis area you see two curves — one for the response of the first filter section and one for the combined response of sections 1, 2, and 3.
When you import a quantized filter into filter designer, or export a quantized filter from filter designer to your workspace, the import and export functions use objects and you specify the filter as a variable. This contrasts with importing and exporting nonquantized filters, where you select the filter structure and enter the filter numerator and denominator for the filter transfer function.
You have the option of exporting quantized filters to your MATLAB workspace, exporting them to text files, or exporting them to MATfiles.
For general information about importing and exporting filters in filter designer, refer to Importing a Filter Design, and Exporting a Filter Design.
Filter designer imports quantized filters having the following structures:
Direct form I
Direct form II
Direct form I transposed
Direct form II transposed
Direct form symmetric FIR
Direct form antisymmetric FIR
Lattice allpass
Lattice AR
Lattice MA minimum phase
Lattice MA maximum phase
Lattice ARMA
Lattice coupledallpass
Lattice coupledallpass power complementary
After you design or open a quantized filter in your MATLAB workspace, filter designer lets you import the filter for analysis. Follow these steps to import your filter in to filter designer:
Open filter designer.
Select File > Import Filter from Workspace from the menu bar, or choose the Import Filter from Workspace icon in the side panel:
.
In the lower region of filter designer, the Design Filter pane becomes Import Filter, and options appear for importing quantized filters, as shown.
From the Filter Structure list,
select Filter object
.
The options for importing filters change to include:
Discrete filter — Enter the variable name for the discretetime, fixedpoint filter in your workspace.
Frequency units — Select the frequency
units from the Units list under Sampling Frequency, and specify the sampling frequency
value in Fs if needed. Your sampling frequency
must correspond to the units you select. For example, when you select
Normalized (0 to 1)
, Fs
defaults to one. But if you choose one of the frequency options, enter the
sampling frequency in your selected units. If you have the sampling frequency
defined in your workspace as a variable, enter the variable name for the sampling
frequency.
Click Import to import the filter.
Filter designer checks your workspace for the specified filter. It imports the filter if it finds it, displaying the magnitude response for the filter in the analysis area. If it cannot find the filter it returns an Filter Designer Error dialog box.
If, during any filter designer session, you switch to quantization mode and create a
fixedpoint filter, filter designer remains in quantization mode. If you import a
doubleprecision filter, filter designer automatically quantizes your imported filter
applying the most recent quantization parameters.
When you check the
current filter information for your imported filter, it will indicate that the filter is
Source: imported (quantized)
even
though you did not import a quantized filter.
To save your filter design, filter designer lets you export the quantized filter to your MATLAB workspace (or you can save the current session in filter designer). When you choose to save the quantized filter by exporting it, you select one of these options:
Export Coefficients, Objects, or System Objects to the Workspace. You can save the filter as filter coefficients variables or filter System object™ variables.
To save the filter to the MATLAB workspace:
Select Export from the File menu. The Export dialog box appears.
Select Workspace
from the Export To list.
From the Export As list, select one of the following options:
Select Coefficients
to save the filter
coefficients.
Select System Objects
to save the filter in a filter
System
object.
The System Objects
option does not appear in the dropdown
list when the current filter structure is not supported by System objects.
Assign a variable name:
For coefficients, assign variable names using the Numerator and Denominator options under Variable Names.
For System objects, assign the variable name in the Discrete Filter option.
If you have variables with the same names in your workspace and you want to overwrite them, select the Overwrite Variables box.
Click Export.
Do not try to export the filter to a variable name that exists in your workspace without selecting Overwrite existing variables, in the previous step. If you do so, filter designer stops the export operation. The tool returns a warning that the variable you specified as the quantized filter name already exists in the workspace.
To continue to export the filter to the existing variable, click OK to dismiss the warning.
Then select the Overwrite existing variables check box and click Export.
Export Filter Coefficients as a Text File. To save your quantized filter as a text file, follow these steps:
Select Export from the File menu.
Select Textfile
under Export to.
Click OK to export the filter and close the dialog box. Click Apply to export the filter without closing the Export dialog box. Clicking Apply lets you export your quantized filter to more than one name without leaving the Export dialog box.
The Export Filter Coefficients to Textfile dialog box appears. This is the standard Microsoft Windows^{®} save file dialog box.
Choose or enter a folder and filename for the text file, and click OK.
Filter designer exports your quantized filter as a text file with the name you provided, and the MATLAB editor opens, displaying the file for editing.
Export Filter Coefficients as a MATFile. To save your quantized filter as a MATfile, follow these steps:
Select Export from the File menu.
Select MATfile
under Export to.
Assign a variable name for the filter.
Click OK to export the filter and close the dialog box. Click Apply to export the filter without closing the Export dialog box. Clicking Apply lets you export your quantized filter to more than one name without leaving the Export dialog box.
The Export Filter Coefficients to MATfile dialog box appears. This dialog box is the standard Microsoft Windows save file dialog box.
Choose or enter a folder and filename for the text file, and click OK.
Filter designer exports your quantized filter as a MATfile with the specified name.
You can generate MATLAB code using the File > Generate MATLAB Code menu. This menu has these options:
Filter Design Function (with System Objects)
This option generates a System object. The option is disabled when the current filter is not supported by system objects.
Data Filtering Function (with System Objects)
This option generates MATLAB code that filters input data with the current filter design. The
MATLAB code is ready to be converted to C/C++ code using the
codegen
command. This option is disabled when the current filter is
not supported by system objects.
You can import XILINX coefficients (.coe
) files into filter
designer to create quantized filters directly using the imported filter
coefficients.
To use the import file feature:
Select File > Import Filter From XILINX Coefficient (.COE) File in filter designer.
In the Import Filter From XILINX
Coefficient (.COE) File dialog box, find and select the
.coe
file to import.
Click Open to dismiss the dialog box and start the import process.
Filter designer imports the coefficient file and creates a quantized, singlesection, directform FIR filter.
The toolbox provides functions for transforming filters between various forms. When you use filter designer with the toolbox installed, a side bar button and a menu bar option enable you to use the Transform Filter panel to transform filters as well as using the command line functions.
From the selection on the filter designer menu bar — Transformations — you can transform lowpass FIR and IIR filters to a variety of passband shapes.
You can convert your FIR filters from:
Lowpass to lowpass.
Lowpass to highpass.
For IIR filters, you can convert from:
Lowpass to lowpass.
Lowpass to highpass.
Lowpass to bandpass.
Lowpass to bandstop.
When you click the Transform Filter button, , on the side bar, the Transform Filter panel opens in filter designer, as shown here.
Your options for Original filter type refer to the type of your current filter to transform. If you select lowpass, you can transform your lowpass filter to another lowpass filter or to a highpass filter, or to numerous other filter formats, real and complex.
When your original filter is an FIR filter, both the FIR and IIR transformed filter type options appear on the Transformed filter type list. Both options remain active because you can apply the IIR transforms to an FIR filter. If your source is as IIR filter, only the IIR transformed filter options show on the list.
Select the magnitude response of the filter you are transforming from the list. Your selection changes the types of filters you can transform to. For example:
When you select Lowpass with an IIR filter, your transformed filter type can be
Lowpass
Highpass
Bandpass
Bandstop
Multiband
Bandpass (complex)
Bandstop (complex)
Multiband (complex)
When you select Lowpass with an FIR filter, your transformed filter type can be
Lowpass
Lowpass (FIR)
Highpass
Highpass (FIR) narrowband
Highpass (FIR) wideband
Bandpass
Bandstop
Multiband
Bandpass (complex)
Bandstop (complex)
Multiband (complex)
In the following table you see each available original filter type and all the types of filter to which you can transform your original.
Original Filter  Available Transformed Filter Types 

Lowpass FIR 

Lowpass IIR 

Highpass FIR 

Highpass IIR 

Bandpass FIR 

Bandpass IIR  Bandpass 
Bandstop FIR 

Bandstop IIR  Bandstop 
Note also that the transform options change depending on whether your original filter is FIR or IIR. Starting from an FIR filter, you can transform to IIR or FIR forms. With an IIR original filter, you are limited to IIR target filters.
After selecting your response type, use Frequency point to transform to specify the magnitude response point in your original filter to transfer to your target filter. Your target filter inherits the performance features of your original filter, such as passband ripple, while changing to the new response form.
For more information about transforming filters, refer to Frequency Transformations for Real Filters and Frequency Transformations for Complex Filters.
The frequency point you enter in this field identifies a magnitude response value (in dB) on the magnitude response curve.
When you enter frequency values in the Specify desired frequency location option, the frequency transformation tries to set the magnitude response of the transformed filter to the value identified by the frequency point you enter in this field.
While you can enter any location, generally you should specify a filter passband or stopband edge, or a value in the passband or stopband.
The Frequency point to transform sets the magnitude response at the values you enter in Specify desired frequency location. Specify a value that lies at either the edge of the stopband or the edge of the passband.
If, for example, you are creating a bandpass filter from a highpass filter, the transformation algorithm sets the magnitude response of the transformed filter at the Specify desired frequency location to be the same as the response at the Frequency point to transform value. Thus you get a bandpass filter whose response at the low and high frequency locations is the same. Notice that the passband between them is undefined. In the next two figures you see the original highpass filter and the transformed bandpass filter.
For more information about transforming filters, refer to Digital Frequency Transformations.
Select the magnitude response for the target filter from the list. The complete list of transformed filter types is:
Lowpass
Lowpass (FIR)
Highpass
Highpass (FIR) narrowband
Highpass (FIR) wideband
Bandpass
Bandstop
Multiband
Bandpass (complex)
Bandstop (complex)
Multiband (complex)
Not all types of transformed filters are available for all filter types on the Original filter types list. You can transform bandpass filters only to bandpass filters. Or bandstop filters to bandstop filters. Or IIR filters to IIR filters.
For more information about transforming filters, refer to Frequency Transformations for Real Filters and Frequency Transformations for Complex Filters.
The frequency point you enter in Frequency point to transform matched a magnitude response value. At each frequency you enter here, the transformation tries to make the magnitude response the same as the response identified by your Frequency point to transform value.
While you can enter any location, generally you should specify a filter passband or stopband edge, or a value in the passband or stopband.
For more information about transforming filters, refer to Digital Frequency Transformations.
Transform Filters. To transform the magnitude response of your filter, use the Transform Filter option on the side bar.
Design or import your filter into filter designer.
Click Transform Filter, , on the side bar.
Filter designer opens the Transform Filter panel in filter designer.
From the Original filter type list, select the response form of the filter you are transforming.
When you select the type, whether is lowpass, highpass, bandpass, or bandstop, filter designer recognizes whether your filter form is FIR or IIR. Using both your filter type selection and the filter form, filter designer adjusts the entries on the Transformed filter type list to show only those that apply to your original filter.
Enter the frequency point to transform value in Frequency point to transform. Notice that the value you enter must be in kHz; for example, enter 0.1 for 100 Hz or 1.5 for 1500 Hz.
From the Transformed filter type list, select the type of filter you want to transform to.
Your filter type selection changes the options here.
When you pick a lowpass or highpass filter type, you enter one value in Specify desired frequency location.
When you pick a bandpass or bandstop filter type, you enter two values — one in Specify desired low frequency location and one in Specify desired high frequency location. Your values define the edges of the passband or stopband.
When you pick a multiband filter type, you enter values as elements in a vector in Specify a vector of desired frequency locations — one element for each desired location. Your values define the edges of the passbands and stopbands.
After you click Transform Filter, filter designer transforms your filter, displays the magnitude response of your new filter, and updates the Current Filter Information to show you that your filter has been transformed. In the filter information, the Source is Transformed.
For example, the figure shown here includes the magnitude response curves for two filters. The original filter is a lowpass filter with rolloff between 0.2 and 0.25. The transformed filter is a lowpass filter with rolloff region between 0.8 and 0.85.
To demonstrate the effects of selecting Narrowband Highpass or Wideband Highpass, the next figure presents the magnitude response curves for a source lowpass filter after it is transformed to both narrow and wideband highpass filters. For comparison, the response of the original filter appears as well.
For the narrowband case, the transformation algorithm essentially reverses the magnitude response, like reflecting the curve around the yaxis, then translating the curve to the right until the origin lies at 1 on the xaxis. After reflecting and translating, the passband at high frequencies is the reverse of the passband of the original filter at low frequencies with the same rolloff and ripple characteristics.
Not only can you design multirate filters from the MATLAB command prompt, filter designer provides the same design capability in a graphical user interface tool. By starting filter designer and switching to the multirate filter design mode you have access to all of the multirate design capabilities in the toolbox — decimators, interpolators, and fractional rate changing filters, among others.
The multirate filter design mode in filter designer lets you specify and design a wide range of multirate filters, including decimators and interpolators.
With filter designer open, click Create a Multirate Filter, , on the side bar. You see filter designer switch to the design mode showing the multirate filter design options. Shown in the following figure is the default multirate design configuration that designs an interpolating filter with an interpolation factor of 2. The design uses the current FIR filter in filter designer.
When the current filter in filter designer is not an FIR filter, the multirate filter design panel removes the Use current FIR filter option and selects the Use default Nyquist FIR filter option instead as the default setting.
You see the options that allow you to design a variety of multirate filters. The Type option is your starting point. From this list you select the multirate filter to design. Based on your selection, other options change to provide the controls you need to specify your filter.
Notice the separate sections of the design panel. On the left is the filter type area where you choose the type of multirate filter to design and set the filter performance specifications.
In the center section filter designer provides choices that let you pick the filter design method to use.
The rightmost section offers options that control filter configuration when you select
CascadedIntegrator Comb (CIC) as the design method in
the center section. Both the Decimator
type and
Interpolator
type filters let you use the CascadedIntegrator Comb (CIC) option to design multirate filters.
Here are all the options available when you switch to multirate filter design mode. Each option listed includes a brief description of what the option does when you use it.
Select and Configure Your Filter
Option  Description 

Type  Specifies the type of multirate filter to design. Choose from

Interpolation Factor  Use the updown control arrows to specify the amount of interpolation to apply to the signal. Factors range upwards from 2. 
Decimation Factor  Use the updown control arrows to specify the amount of decimation to apply to the signal. Factors range upwards from 2. 
Sampling Frequency  No settings here. Just Units and Fs below. 
Units  Specify whether Fs is specified in

Fs  Set the full scale sampling frequency in the frequency units you
specified in Units. When you select

Design Your Filter
Option  Description 

Use current FIR filter  Directs filter designer to use the current FIR filter to design the multirate filter. If the current filter is an IIR form, you cannot select this option. You cannot design multirate filters with IIR structures. 
Use a default Nyquist Filter  Tells filter designer to use the default Nyquist design method when the current filter in filter designer is not an FIR filter. 
Cascaded IntegratorComb (CIC)  Design CIC filters using the options provided in the righthand area of the multirate design panel. 
Hold Interpolator (Zeroorder)  When you design an interpolator, you can specify how the filter sets interpolated values between signal values. When you select this option, the interpolator applies the most recent signal value for each interpolated value until it processes the next signal value. This is similar to sampleandhold techniques. Compare to the Linear Interpolator option. 
Linear Interpolator (Firstorder)  When you design an interpolator, you can specify how the filter sets interpolated values between signal values. When you select this option, the interpolator applies linear interpolation between signal value to set the interpolated value until it processes the next signal value. Compare to the Linear Interpolator option. 
To see the difference between hold interpolation and linear interpolation, the following figure presents a sine wave signal s1 in three forms:
The top subplot in the figure presents signal s1 without interpolation.
The middle subplot shows signal s1 interpolated by a linear interpolator with an interpolation factor of 5.
The bottom subplot shows signal s1 interpolated by a hold interpolator with an interpolation factor of 5.
You see in the bottom figure the sample and hold nature of hold interpolation, and the firstorder linear interpolation applied by the linear interpolator.
Options for Designing CIC Filters  Description 

Differential Delay  Sets the differential delay for the CIC filter. Usually a value of one or two is appropriate. 
Number of Sections  Specifies the number of sections in a CIC decimator. The default number of sections is 2 and the range is any positive integer. 
Design a Fractional Rate Convertor. To introduce the process you use to design a multirate filter in filter designer, this example uses the options to design a fractional rate convertor which uses 7/3 as the fractional rate. Begin the design by creating a default lowpass FIR filter in filter designer. You do not have to begin with this FIR filter, but the default filter works fine.
Launch filter designer.
Select the settings for a minimumorder lowpass FIR filter,
using the Equiripple
design method.
When filter designer displays the magnitude response for the filter, click in the side bar. filter designer switches to multirate filter design mode, showing the multirate design panel.
To design a fractional rate filter, select
Fractionalrate convertor
from the Type list. The Interpolation Factor
and Decimation Factor options become
available.
In Interpolation Factor, use
the up arrow to set the interpolation factor to 7
.
Using the up arrow in Decimation
Factor, set 3
as the decimation factor.
Select Use a default Nyquist FIR filter
.
You could design the rate convertor with the current FIR filter as well.
Enter 24000 to set Fs.
Click Create Multirate Filter.
After designing the filter, filter designer returns with the specifications for your new filter displayed in Current Filter Information, and shows the magnitude response of the filter.
You can test the filter by exporting it to your workspace and using it to filter a signal. For information about exporting filters, refer to Import and Export Quantized Filters.
Design a CIC Decimator for 8 Bit Input/Output Data. Another kind of filter you can design in filter designer is CascadedIntegrator Comb (CIC) filters. Filter designer provides the options needed to configure your CIC to meet your needs.
Launch filter designer and design the default FIR lowpass filter. Designing a filter at this time is an optional step.
Switch filter designer to multirate design mode by clicking on the side bar.
For Type, select
Decimator
, and set Decimation
Factor to 3
.
To design the decimator using a CIC implementation, select CascadedIntegrator Comb (CIC). This enables the CICrelated options on the right of the panel.
Set Differential Delay to 2. Generally, 1 or 2 are good values to use.
Enter 2
for the Number of Sections.
Click Create Multirate Filter.
Filter Designer designs the filter, shows the magnitude response in the analysis area, and updates the current filter information to show that you designed a tenthorder cascadedintegrator comb decimator with two sections. Notice the source is Multirate Design, indicating you used the multirate design mode in filter designer to make the filter. Filter Designer should look like this now.
Designing other multirate filters follows the same pattern.
To design other multirate filters, do one of the following depending on the filter to design:
To design an interpolator, select one of these options.
Use a default Nyquist FIR filter
CascadedIntegrator Comb (CIC)
Hold Interpolator (Zeroorder)
Linear Interpolator (Firstorder)
To design a decimator, select from these options.
Use a default Nyquist FIR filter
CascadedIntegrator Comb (CIC)
To design a fractionalrate convertor, select Use a default Nyquist FIR filter.
After you design a multirate filter in filter designer, the quantization features enable you to convert your floatingpoint multirate filter to fixedpoint arithmetic.
CIC filters are always fixedpoint.
With your multirate filter as the current filter in filter designer, you can quantize your filter and use the quantization options to specify the fixedpoint arithmetic the filter uses.
Quantize and Configure Multirate Filters. Follow these steps to convert your multirate filter to fixedpoint arithmetic and set the fixedpoint options.
Design or import your multirate filter and make sure it is the current filter in filter designer.
Click the Set Quantization Parameters button on the side bar.
From the Filter Arithmetic
list on the Filter Arithmetic pane, select Fixedpoint
.
If your filter is a CIC filter, the Fixedpoint
option is
enabled by default and you do not set this option.
In the quantization panes, set the options for your filter. Set options for Coefficients, Input/Output, and Filter Internals.
Click Apply.
When you current filter is a CIC filter, the options on the Input/Output and Filter Internals panes change to provide specific features for CIC filters.
Input/Output. The options that specify how your CIC filter uses input and output values are listed in the table below.
Option Name  Description 

Input Word Length  Sets the word length used to represent the input to a filter. 
Input fraction length  Sets the fraction length used to interpret input values to filter. 
Input range (+/)  Lets you set the range the inputs represent. You use this instead of the Input fraction length option to set the precision. When you enter a value x, the resulting range is x to x. Range must be a positive integer. 
Output word length  Sets the word length used to represent the output from a filter. 
Avoid overflow  Directs the filter to set the fraction length for the input to prevent the output values from exceeding the available range as defined by the word length. Clearing this option lets you set Output fraction length. 
Output fraction length  Sets the fraction length used to represent output values from a filter. 
Output range (+/)  Lets you set the range the outputs represent. You use this instead of the Output fraction length option to set the precision. When you enter a value x, the resulting range is x to x. Range must be a positive integer. 
The available options change when you change the Filter
precision setting. Moving from Full
to Specify
all
adds increasing control by enabling more input and output word
options.
Filter Internals. With a CIC filter as your current filter, the Filter precision option on the Filter Internals pane includes modes for controlling the filter word and fraction lengths.
There are four usage modes for this (the same mode you select for the
FilterInternals
property in CIC filters at the MATLAB prompt).
Full
— All word and fraction lengths set to
B_{max} + 1, called B_{accum}. This is the
default.
Minimum section word lengths
— Set the section word
lengths to minimum values that meet roundoff noise and output requirements.
Specify word lengths
— Enables the Section word length option for you to enter word lengths
for each section. Enter either a scalar to use the same value for every section, or
a vector of values, one for each section.
Specify all
— Enables the Section fraction length option in addition to Section word length. Now you can provide both the word and fraction
lengths for each section, again using either a scalar or a vector of values.
After designing a polyphase filter in the filter designer app, you can obtain the individual phase coefficients of the filter by:
Exporting the filter to an object in the MATLAB workspace.
Using the polyphase method to create a matrix of the filter's coefficients.
Export the Polyphase Filter to an Object. To export a polyphase filter to an object in the MATLAB workspace, complete the following steps.
In filter designer, open the File menu and select Export.... This opens the dialog box for exporting the filter coefficients.
In the Export dialog box, for Export To, select Workspace.
For Export As, select Object.
(Optional) For Variable Names, enter the name of the Multirate Filter object that will be created in the MATLAB workspace.
Click the Export button. The
multirate filter object, Hm
in this example, appears in the
MATLAB workspace.
Create a Matrix of Coefficients Using the polyphase Method. To create a matrix of the filter's coefficients, enter
p=polyphase(Hm)
at the command line. The polyphase
method creates a matrix, p
, of filter
coefficients from the filter object, Hm
. Each row of
p
consists of the coefficients of an individual phase subfilter.
The first row contains to the coefficients of the first phase subfilter, the second row
contains those of the second phase subfilter, and so on.
After you design or import a filter in filter designer, the realize model feature lets you create a Simulink subsystem block that implements your filter. The generated filter subsystem block uses either digital filter blocks from the DSP System Toolbox library, or the Delay, Gain, and Sum blocks in Simulink. If you do not have a FixedPoint Designer™ license, filter designer still realizes your model using blocks in fixedpoint mode from Simulink, but you cannot run any model that includes your filter subsystem block in Simulink.
To access to the Realize Model panel and the options for realizing your quantized filter as a Simulink subsystem block, switch filter designer to realize model mode by clicking on the sidebar.
The following panel shows the options for configuring how filter designer implements your filter as a Simulink block.
For information on these parameters, see the descriptions on the Filter Realization Wizard block reference page.
Realize a Filter Using Filter Designer. After your quantized filter in filter designer is performing the way you want, with your desired phase and magnitude response, and with the right coefficients and form, follow these steps to realize your filter as a subsystem that you can use in a Simulink model.
Click Realize Model on the sidebar to change filter designer to realize model mode.
From the Destination list under Model, select either:
Current model
— to add the realized filter
subsystem to your current model
New model
— to open a new Simulink model window and add your filter subsystem to the new
window
Provide a name for your new filter subsystem in the Name field.
Decide whether to overwrite an existing block with this new one, and select or clear the Overwrite generated ‘Filter’ block check box.
Select the Build model using basic elements check box to implement your filter as a subsystem block that consists of Sum, Gain, and Delay blocks.
Select or clear the optimizations to apply.
Optimize for zero gains — removes zero gain blocks from the model realization
Optimize for unity gains — replaces unity gain blocks with direct connections to adjacent blocks
Optimize for negative gains — replaces negative gain blocks by a change of sign at the nearest sum block
Optimize delay chains — replaces cascaded delay blocks with a single delay block that produces the equivalent gain
Optimize for unity scale values — removes all scale value multiplications by 1 from the filter structure
Click Realize Model to realize your quantized filter as a subsystem block according to the settings you selected.
If you doubleclick the filter block subsystem created by filter designer, you see the filter implementation in Simulink model form. Depending on the options you chose when you realized your filter, and the filter you started with, you might see one or more sections, or different architectures based on the form of your quantized filter. From this point on, the subsystem filter block acts like any other block that you use in Simulink models.