Design bandstop filter
Filtering / Filter Designs
dspfdesign
This block brings the filter design capabilities of the
function
to the Simulink^{®} environment.filterbuilder
See Bandstop Filter Design Dialog Box — Main Pane for more information about the parameters of this block. The Data Types and Code Generation panes are not available for blocks in the DSP System Toolbox™ Filter Designs library.
This button opens the Filter Visualization Tool (fvtool
) from the Signal Processing Toolbox™ product.
You can use the tool to display:
Magnitude response, phase response, and group delay in the frequency domain.
Impulse response and step response in the time domain.
Polezero information.
The tool also helps you evaluate filter performance by providing information about filter order, stability, and phase linearity. For more information on FVTool, see the Signal Processing Toolbox documentation.
In this group, you specify your filter format, such as the impulse response and the filter order.
Select either FIR
or IIR
from
the dropdown list. FIR
is the default.
When you choose an impulse response, the design methods and structures
you can use to implement your filter change accordingly.
Note: The design methods and structures for FIR filters are not the same as the methods and structures for IIR filters. 
Select Minimum
(the default) or Specify
.
Selecting Specify
enables the Order option
so you can enter the filter order. When you set the Impulse
response to IIR
, you can specify
different numerator and denominator orders. To specify a different
denominator order, you must select the Denominator order check
box.
Enter the filter order. This option is enabled only if you set
the Order mode to Specify
.
Select this check box to specify a different denominator order.
This option is enabled only if you set the Impulse response to IIR
and
the Order mode to Specify
.
Select Singlerate
, Decimator
, Interpolator
,
or Samplerate converter
. Your choice determines
the type of filter as well as the design methods and structures that
are available to implement your filter. By default, the block specifies
a singlerate filter.
Selecting Decimator
or Interpolator
activates
the Decimation Factor or the Interpolation
Factor options respectively.
Selecting Samplerate converter
activates
both factors.
Enter the decimation factor. This option is enabled only if
the Filter type is set to Decimator
or Samplerate
converter
. The default value is 2.
Enter the interpolation factor. This option is enabled only
if the Filter type is set to Interpolator
or Samplerate
converter
. The default value is 2.
The parameters in this group allow you to specify your filter response curve. Graphically, the filter specifications look similar to those shown in the following figure.
When Order mode is Specify
,
select the filter features that the block uses to define the frequency
response characteristics. The list contains the following options,
when available for the filter specifications.
Passband and stopband edges
—
Define the filter by specifying the frequencies for the edges for
the stop and passbands.
Passband edges
— For IIR
filters, define the filter by specifying frequencies for the edges
of the passband.
Stopband edges
— For IIR
filters, define the filter by specifying frequencies for the edges
of the stopbands.
3 dB points
— For IIR filters,
define the filter response by specifying the locations of the 3 dB
points. The 3 dB point is the frequency for the point three decibels
below the passband value.
3 dB points and passband width
—
For IIR filters, define the filter by specifying frequencies for the
3 dB points in the filter response and the width of the passband.
3 dB points and stopband widths
—
For IIR filters, define the filter by specifying frequencies for the
3 dB points in the filter response and the width of the stopband.
6 dB points
— For FIR filters,
define the filter response by specifying the locations of the 6 dB
points. The 6 dB point is the frequency for the point six decibels
below the passband value.
Use this parameter to specify whether your frequency settings
are normalized or in absolute frequency. Select Normalized
(0–1)
to enter frequencies in normalized form.
This behavior is the default. To enter frequencies in absolute values,
select one of the frequency units from the dropdown list—Hz
, kHz
, MHz
,
or GHz
. Selecting one of the unit options
enables the Input Fs parameter.
Fs, specified in the units you selected for Frequency units, defines the sampling frequency at the filter input. When you provide an input sampling frequency, all frequencies in the specifications are in the selected units as well. This parameter is available when you select one of the frequency options from the Frequency units list.
When you design an interpolator, Fs represents the sampling
frequency at the filter output rather than the filter input. This
option is available only when you set Filter type is interpolator
.
Enter the frequency at the edge of the end of the first passband. Specify the value in either normalized frequency units or the absolute units you select in Frequency units.
Enter the frequency at the edge of the start of the stopband. Specify the value in either normalized frequency units or the absolute units you select in Frequency units.
Enter the frequency at the edge of the end of the stopband. Specify the value in either normalized frequency units or the absolute units you select in Frequency units.
Enter the frequency at the edge of the start of the second passband. Specify the value in either normalized frequency units or the absolute units you select in Frequency units.
When Frequency constraints is 3
dB points
, 3 dB points and passband width
,
or 3 dB points and stopband width
, specify
the lowerfrequency 3 dB point.
When Frequency constraints is 3
dB points
, 3 dB points and passband width
,
or 3 dB points and stopband width
, specify
the higherfrequency 3 dB point.
When Frequency constraints is 6
dB points
, specify the lowerfrequency 6 dB point.
When Frequency constraints is 6
dB points
, specify the higherfrequency 6 dB point.
When Frequency constraints is 3
dB points and passband width
, specify the width of the passband,
in units corresponding to the Frequency units parameter.
When Frequency constraints is 3
dB points and stopband width
, specify the width of the stopband,
in units corresponding to the Frequency units parameter.
Parameters in this group specify the filter response in the passbands and stopbands.
This option is only available when you specify the order of
your filter design. The options for Magnitude constraints depend
on the value of the Frequency constraints. Depending
on the value of the Frequency constraints parameter,
some combination of the following options will be available for the Magnitude
constraints parameter: Unconstrained
, Passband
ripple and stopband attenuation
, or Constrained
bands
.
Specify the units for any parameter you provide in magnitude specifications. From the dropdown list, select one of the following options:
Linear
— Specify
the magnitude in linear units.
dB
— Specify the
magnitude in decibels (default).
Squared
— Specify
the magnitude in squared units.
Enter the filter ripple allowed in the first passband in the units you choose for Magnitude units, either linear or decibels.
Enter the filter attenuation in the stopband in the units you choose for Magnitude units, either linear or decibels
Enter the filter ripple allowed in the second passband in the units you choose for Magnitude units, either linear or decibels
The parameters in this group allow you to specify the design method and structure of your filter.
Lists the design methods available for the frequency and magnitude
specifications you entered. When you change the specifications for
a filter, such as changing the impulse response, the methods available
to design filters changes as well. The default IIR design method is
usually Butterworth, and the default FIR method is Equiripple
.
Selecting this parameter directs the design to scale the filter coefficients to reduce the chances that the inputs or calculations in the filter overflow and exceed the representable range of the filter. Clearing this option removes the scaling. This parameter applies only to IIR filters.
The options for each design are specific for each design method. This section does not present all of the available options for all designs and design methods. There are many more that you encounter as you select different design methods and filter specifications. The following options represent some of the most common ones available.
Density factor controls the density of the frequency grid over which the design method optimization evaluates your filter response function. The number of equally spaced points in the grid is the value you enter for Density factor times (filter order + 1).
Increasing the value creates a filter that more closely approximates an ideal equiripple filter but increases the time required to design the filter. The default value of 20 represents a reasonable trade between the accurate approximation to the ideal filter and the time to design the filter.
Specify the phase constraint of the filter as Linear
, Maximum
,
or Minimum
.
When you select this parameter, the design method determines
and design the minimum order filter to meet your specifications. Some
filters do not provide this parameter. Select Any
, Even
,
or Odd
from the dropdown list to direct
the design to be any minimum order, or minimum even order, or minimum
odd order.
Specifies that the resulting filter design matches either the
passband or stopband or both bands when you select passband
or stopband
or both
from
the dropdown list.
For the filter specifications and design method you select, this parameter lists the filter structures available to implement your filter. By default, FIR filters use directform structure, and IIR filters use directform II filters with SOS.
Select this check box to implement the filter as a subsystem of basic Simulink blocks. Clear the check box to implement the filter as a highlevel subsystem. By default, this check box is cleared.
The highlevel implementation provides better compatibility across various filter structures, especially filters that would contain algebraic loops when constructed using basic elements. On the other hand, using basic elements enables the following optimization parameters:
Optimize for zero gains — Terminate chains that contain Gain blocks with a gain of zero.
Optimize for unit gains — Remove Gain blocks that scale by a factor of one.
Optimize for delay chains — Substitute delay chains made up of n unit delays with a single delay by n.
Optimize for negative gains — Use subtraction in Sum blocks instead of negative gains in Gain blocks.
Select this check box to scale unit gains between sections in SOS filters. This parameter is available only for SOS filters.
Specify how the block should process the input. The available options may vary depending on he settings of the Filter Structure and Use basic elements for filter customization parameters. You can set this parameter to one of the following options:
Columns as channels (frame based)
—
When you select this option, the block treats each column of the input
as a separate channel.
Elements as channels (sample based)
—
When you select this option, the block treats each element of the
input as a separate channel.
Note:
The 
When the Filter type parameter specifies a multirate filter, select the rate processing rule for the block from following options:
Enforce singlerate processing
—
When you select this option, the block maintains the sample rate of
the input.
Allow multirate processing
—
When you select this option, the block adjusts the rate at the output
to accommodate an increased or reduced number of samples. To select
this option, you must set the Input processing parameter
to Elements as channels (sample based)
.
Select this check box to enable the specification of coefficients using MATLAB^{®} variables. The available coefficient names differ depending on the filter structure. Using symbolic names allows tuning of filter coefficients in generated code. By default, this check box is cleared.
Port  Supported Data Types 

Input 

Output 
