DSP System Toolbox™ software adds new dialog boxes and operating modes, and new menu selections, to the Filter Design and Analysis Tool (FDATool) 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 GUI using the design mode.
Quantize doubleprecision filters you import into this GUI 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 FDATool, 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 FDATool. 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 FDATool are available as command line functions, the graphical user interface of FDATool makes the design process more clear and easier to accomplish.
As you select a response type, the options in the right panes in FDATool 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 FDATool 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.
FDATool 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 FDATool, 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 FDATool and analyzed with the available analyses on the Analysis menu.
You use the quantization panel in FDATool to quantize filters. Quantization represents the fourth operating mode for FDATool, along with the filter design, filter transformation, and import modes. To switch to quantization mode, open FDATool from the MATLAB^{®} command prompt by entering
fdatool
When FDATool opens, click the Set Quantization Parameters button on the side bar. FDATool switches to quantization mode and you see the following panel at the bottom of FDATool, 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 FDATool,
select Fixedpoint
from the Filter
Arithmetic.
The quantization options appear in the lower panel of FDATool. 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 FDATool:
Coefficients provides access the settings for defining the coefficient quantization. This is the default active panel when you switch FDATool to quantization mode without a quantized filter in the tool. When you import a fixedpoint filter into FDATool, this is the active pane when you switch to quantization mode.
Input/Output switches FDATool 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 FDATool to set the properties. Using options in the Set Quantization Parameters dialog box, FDATool 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 FDATool 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 FDATool, 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, FDATool 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 FDATool 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 FDATool to interpret the coefficients as unsigned values. 
Scale the numerator coefficients to fully utilize the entire dynamic range  All filters  Directs FDATool 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 
Note: 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 FDATool.
Select Singleprecision floating
point
or Fixedpoint
from Filter arithmetic.
When you select one of the optional arithmetic settings, FDATool 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.
FDATool quantizes your filter using your new settings.
Use the analysis features in FDATool 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 FDATool 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, FDATool 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 FDATool.
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 FDATool:
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 FDATool to design a sixthorder Butterworth IIR filter.
To Use NoiseBased Analysis in FDATool.
Enter fdatool
at
the MATLAB prompt to launch FDATool.
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 FDATool, 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.
FDATool 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.
FDATool 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, FDATool 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 FDATool used to test your filter.
From the Analysis menu bar option, select Roundoff Noise Power Spectrum. In the analysis area in FDATool, 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 FDATool, 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 FDATool 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.
FDATool 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 FDATool 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 FDATool, select Analysis > Overlay Analysis from the menu bar. Then select Magnitude Response to show both response curves plotted together in the analysis area.
FDATool 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 FDATool, refer to Converting the Filter Structure in your Signal Processing Toolbox documentation.
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, FDATool 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 FDATool to convert your quantized filter to use secondorder sections, refer to Converting to SecondOrder Sections in your Signal Processing Toolbox documentation. You might notice that filters you design in FDATool, rather than filters you imported, are implemented in SOS form.
View Filter Structures in FDATool. 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.
FDATool provides the ability to scale SOS filters after you create them. Using options on the Reordering and Scaling SecondOrder Sections dialog box, FDATool 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 FDATool.
Launch FDATool.
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 FDATool 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 FDATool and select Filter Coefficients from the Analysis menu. FDATool displays the coefficients and scale values in FDATool.
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 FDATool 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, FDATool 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.
FDATool 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 FDATool, either one you designed in the tool, or one you imported, FDATool provides the capability to change the order of the sections that compose the filter. Any SOS filter in FDATool allows reordering of the sections.
To reorder the sections of a filter, you access the Reorder and Scaling of SecondOrder Sections dialog box in FDATool.
With your SOS filter in FDATool, select Edit > Reorder and Scale from the menu bar. FDATool 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 FDATool 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 FDATool from the command prompt.
Enter fdatool
at
the command prompt to launch FDATool.
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.
FDATool 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 FDATool, reordering the filter
uses the Reordering and Scaling of SecondOrder
Sections feature in FDATool (also available in Filter Visualization
Tool, fvtool
).
To reorder your filter, select Edit > Reorder and Scale SecondOrder Sections from the FDATool menus.
Now you are ready to reorder the sections of your filter. Note that FDATool performs the reordering on the current filter in the session.
Use Least Selective to Most Selective Section Reordering. To let FDATool 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 FDATool, select View > SOS View Settings from the menu bar so you see the sections of your filter displayed in FDATool.
In the SOS View Settings dialog box, select Individual sections. Making this choice configures FDATool 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, FDATool 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, FDATool 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 FDATool, 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 FDATool 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 FDATool to show the phase responses for filters, enabling SOS View means FDATool 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 FDATool displays the sections, or which sections to display. When you select View > SOS View from the FDATool 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 FDATool. 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, FDATool 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, FDATool 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 FDATool analysis area to the new SOS View configuration. 
Use secondaryscaling points  This directs FDATool 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 FDATool, the SOS view option lets you see the per section performance of your filter. Enabling SOS View from the View menu in FDATool 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 FDATool.
Launch FDATool.
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.
FDATool 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 FDATool 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 FDATool to display the responses for each filter section. The analysis area changes to show you something like the following figure.
If you switch FDATool 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 FDATool 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 FDATool 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 FDATool, or export a quantized filter from FDATool 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 FDATool, refer to Importing a Filter Design, and Exporting a Filter Design.
FDATool 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, FDATool lets you import the filter for analysis. Follow these steps to import your filter in to FDATool:
Open FDATool.
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 FDATool, 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.
FDATool 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 FDATool Error dialog box.
Note:
If, during any FDATool session, you switch to quantization mode
and create a fixedpoint filter, FDATool remains in quantization mode.
If you import a doubleprecision filter, FDATool automatically quantizes
your imported filter applying the most recent quantization parameters. 
To save your filter design, FDATool lets you export the quantized filter to your MATLAB workspace (or you can save the current session in FDATool). 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, dfilt
filter object variables, or 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 Objects
to save the filter
in a filter object.
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 objects or 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, FDATool 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.
Getting Filter Coefficients After Exporting. To extract the filter coefficients from your quantized filter
after you export the filter to MATLAB, use the celldisp
function in MATLAB. For
example, create a quantized filter in FDATool, and export the filter
as Hq
. To extract the filter coefficients for Hq
,
use
celldisp(Hq.referencecoefficients)
which returns the cell array containing the filter reference coefficients, or
celldisp(Hq.quantizedcoefficients
to return the quantized coefficients.
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.
FDATool 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.
FDATool 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 three options:
Filter Design Function
This option creates MATLAB code that generates the DFILT/MFILT object currently designed in FDATool.
Filter Design Function (with System Objects)
This option is similar to the previous option with the difference that a System object is generated instead of a DFILT/MFILT 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 FDATool 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 FDATool.
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.
FDATool 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 FDATool 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 FDATool 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 FDATool, 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.
Note: 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 FDATool.
Click Transform Filter, , on the side bar.
FDATool opens the Transform Filter panel in FDATool.
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, FDATool recognizes whether your filter form is FIR or IIR. Using both your filter type selection and the filter form, FDATool 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, FDATool 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, FDATool provides the same design capability in a graphical user interface tool. By starting FDATool 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 FDATool lets you specify and design a wide range of multirate filters, including decimators and interpolators.
With FDATool open, click Create a Multirate Filter, , on the side bar. You see FDATool 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 FDATool.
When the current filter in FDATool 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 FDATool 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 FDATool 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 FDATool to use the default Nyquist design method when the current filter in FDATool 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.
We used FDATool to create interpolators similar to the following code for the figure:
Linear interpolator — hm=mfilt.linearinterp(5)
Hold interpolator — hm=mfilt.holdinterp(5)
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 FDATool, 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 FDATool. You do not have to begin with this FIR filter, but the default filter works fine.
Launch FDATool.
Select the settings for a minimumorder
lowpass FIR filter, using the Equiripple
design
method.
When FDATool displays the magnitude response for the filter, click in the side bar. FDATool 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, FDATool 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 FDATool is CascadedIntegrator Comb (CIC) filters. FDATool provides the options needed to configure your CIC to meet your needs.
Launch FDATool and design the default FIR lowpass filter. Designing a filter at this time is an optional step.
Switch FDATool 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.
FDATool 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 FDATool to make the filter. FDATool 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 FDATool, the quantization features enable you to convert your floatingpoint multirate filter to fixedpoint arithmetic.
Note: CIC filters are always fixedpoint. 
With your multirate filter as the current filter in FDATool, 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 FDATool.
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} by
Harris in [2]. Full
Precision is the default setting.
Minimum section word lengths
—
Set the section word lengths to minimum values that meet roundoff
noise and output requirements as defined by Hogenauer in [3].
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 Filter Design Analysis Tool (FDATool), 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 FDATool, 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 FDATool, 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, FDATool 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 FDATool to realize model mode by clicking on the sidebar.
The following panel shows the options for configuring how FDATool 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 FDATool. After your quantized filter in FDATool 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 FDATool 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 FDATool, 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.
Supported Filter Structures. FDATool lets you realize discretetime and multirate filters from the following forms:
Structure  Description 

 Decimators based on FIR filters 
 Decimators based on transposed FIR filters 
 Linear interpolators 
 Interpolators based on FIR filters 
 Multirate filters 
 Interpolators that use the hold interpolation algorithm 
 Discretetime filters with allpass structure 
 
 
 Decimators based on IIR filters 
 
 Interpolators based on IIR filters 
 
