Bandstop Filter
(To be removed) Design bandstop filter
The Bandstop Filter block will be removed in a future release. Use the Bandstop FIR Filter Design block or the Bandstop IIR Filter Design block instead.
Libraries:
DSP System Toolbox /
Filtering /
Filter Designs
Description
This block brings the filter design capabilities of the filterBuilder
function to the Simulink^{®} environment.
This block supports C/C++ code generation and SIMD code generation. For details, see Code Generation.
Ports
Input
Port_1 — Input signal
scalar  vector  matrix
Input signal to filter, specified as a scalar, vector, or matrix.
Data Types: single
 double
Output
Port_1 — Filtered output signal
scalar  vector  matrix
Filtered output signal, specified as a scalar, vector, or matrix.
Data Types: single
 double
Parameters
View Filter Response — Open Filter Visualization Tool
button
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.
Impulse response — FIR or IIR filter
FIR
(default)  IIR
Specify whether the block implements an FIR
or
IIR
filter.
Note
The design methods and structures for FIR filters are not the same as the methods and structures for IIR filters.
Order mode — Mode of specifying filter order
Minimum
(default)  Specify
Select Minimum
to have the block implement a
filter with minimum order. When you select
Specify
, you must enter the filter order
using the Order parameter.
Tip
When you set the Impulse response to
IIR
, you can specify different numerator
and denominator orders. To specify a different denominator order, select
the Denominator order check box.
Order — Filter order
20
(default)  positive integer
Specify the filter order as a positive integer.
Dependencies
To enable this parameter, set Order mode to
Specify
.
Denominator order — Specify denominator order
off
(default)  on
Select this check box to specify a different denominator order. When you select this check box, you can specify the denominator order as a positive integer in the resulting text box.
Dependencies
To enable this parameter, set the Impulse
response to IIR
and the
Order mode to
Specify
.
Filter type — Type of filter
Singlerate
(default)  Decimator
 Interpolator
 Samplerate converter
Select the type of filter to implement. Your choice determines the type of filter and the design methods and structures that are available to implement your filter.
Dependencies
This parameter applies only when you set Impulse response to
FIR
.Selecting
Decimator
orInterpolator
activates the Decimation Factor or the Interpolation Factor options respectively.Selecting
Samplerate converter
activates both factors.
Decimation Factor — Decimation factor
2
(default)  positive integer
Specify the decimation factor as a positive integer.
Dependencies
To enable this parameter, set the Filter type to
Decimator
or Samplerate
converter
.
Interpolation Factor — Interpolation factor
2
(default)  positive integer
Specify the interpolation factor as a positive integer.
Dependencies
To enable this parameter, set the Filter type to
Interpolator
or Samplerate
converter
.
Frequency constraints — Frequency response constraints
Passband and stopband
edges
(default)  Passband edges
 Half power (3dB) frequencies
 Half power (3dB) frequencies and passband
width
 Half power (3dB) frequencies and stopband
width
 Cutoff (6dB) frequencies
When you set the Order mode to
Specify
, this parameter allows you to choose
the filter features that the block uses to define the frequency response
characteristics. Depending on the Impulse response you
choose, you can set the Frequency constraints to one
of:
Passband and stopband edges
— Specify 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.Half power (3dB) frequencies
— 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.Half power (3dB) frequencies 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.Half power (3dB) frequencies and stopband width
— For IIR filters, define the filter by specifying frequencies for the 3 dB points in the filter response and the width of the stopband.Cutoff (6dB) frequencies
— 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 6 dB below the passband value.
Dependencies
To enable this parameter, set the Order mode to
Specify
. The available
Frequency constraints will depend on whether
the Impulse response is
FIR
or
IIR
.
Frequency units — Frequency units
Normalized (0 to 1)
(default)  Hz
 kHz
 MHz
 GHz
Use this parameter to specify whether your frequency settings are
normalized or in absolute frequency. Select Normalized (0 to
1)
to enter frequencies in normalized form. To enter
frequencies in absolute values, select one of the frequency units from the
dropdown list—Hz
,
kHz
, MHz
, or
GHz
.
Input sample rate — Input sample rate
2
(default)  positive scalar
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.
Dependencies
To enable this parameter, set Filter type to
Singlerate
,
Decimator
, or Samplerate
converter
and Frequency units to
one of the unit options (Hz
,
kHz
, MHz
, or
GHz
).
Output sample rate — Output sample rate
2
(default)  positive scalar
When you design an interpolator, Fs
represents the
sampling frequency at the filter output rather than the filter input.
Dependencies
To enable this parameter, set Filter type to
Interpolator
and Frequency
units to one of the unit options
(Hz
, kHz
,
MHz
, or
GHz
).
Passband frequency 1 — Frequency at edge of end of first passband
0.35
(default)  positive scalar
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.
Stopband frequency 1 — Frequency at edge of start of stopband
0.45
(default)  positive scalar
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.
Stopband frequency 2 — Frequency at edge of end of stopband
0.55
(default)  positive scalar
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.
Passband frequency 2 — Frequency at edge of start of second passband
0.65
(default)  positive scalar
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.
Half power (3dB) frequency 1 — Lower frequency 3 dB point
0.4
(default)  positive scalar
Specify the lower frequency 3 dB point as a positive scalar between zero and one.
Dependencies
To enable this parameter, set Impulse response to
IIR
, Order mode to
Specify
, and Frequency
constraints to Half power (3dB)
frequencies
, Half power (3dB) frequencies
and passband width
, or Half power (3dB)
frequencies and stopband width
.
Half power (3dB) frequency 2 — Higher frequency 3 dB point
0.6
(default)  positive scalar
Specify the higher frequency 3 dB point as a positive scalar between zero and one.
Dependencies
To enable this parameter, set Impulse response to
IIR
, Order mode to
Specify
, and Frequency
constraints to Half power (3dB)
frequencies
, Half power (3dB) frequencies
and passband width
, or Half power (3dB)
frequencies and stopband width
.
Cutoff (6dB) frequency 1 — Lower frequency 6 dB point
0.4
(default)  positive scalar
Specify the lower frequency 6 dB point as a positive scalar between zero and one.
Dependencies
To enable this parameter, set Frequency
constraints to Cutoff (6dB)
frequencies
.
Cutoff (6dB) frequency 2 — Higher frequency 6 dB point
0.6
(default)  positive scalar
Specify the higher frequency 6 dB point as a positive scalar between zero and one.
Dependencies
To enable this parameter, set Frequency
constraints to Cutoff (6dB)
frequencies
.
Passband width — Passband width
0.25
(default)  positive scalar
Specify the width of the passband as a positive scalar, in units corresponding to the Frequency units parameter.
Dependencies
To enable this parameter, set Frequency
constraints to Half power (3dB) frequencies
and passband width
.
Stopband width — Width of stopband
0.15
(default)  positive scalar
Specify the width of the stopband as a positive scalar, in units corresponding to the Frequency units parameter.
Dependencies
To enable this parameter, set Frequency
constraints to Half power (3dB) frequencies
and stopband width
.
Magnitude constraints — Magnitude constraints
Unconstrained
(default)  Constrained bands
 Passband ripples and stopband
attenuation
Specify the magnitude constraints for the filter design.
Dependencies
To enable this parameter, set Order mode to
Specify
. The available options depend on
the value of the Frequency constraints
parameter.
Magnitude units — Units for magnitude specifications
dB
(default)  Linear
 Squared
Specify the units for any parameter you provide in magnitude specifications:
Linear
— Specify the magnitude in linear units.dB
— Specify the magnitude in decibels (default).Squared
— Specify the magnitude in squared units.
Dependencies
To enable this parameter, set Order mode to
Minimum
.
Passband ripple 1 — Allowable filter ripple in first passband
1
(default)  realvalued positive scalar
Specify the filter ripple allowed in the first passband in the units you choose for Magnitude units. Values must be real, positive scalars. If you are specifying values in linear units, they must be smaller than 1.
Dependencies
To enable this parameter, set the Order mode to
Minimum
.
Stopband attenuation — Stopband attenuation
60
(default)  realvalued positive scalar
Enter the filter attenuation in the stopband in the units you choose for Magnitude units. Values must be real, positive scalars. If you are specifying values in linear units, they must be smaller than 1.
Dependencies
To enable this parameter, set the Order mode to
Minimum
.
Passband ripple 2 — Allowable filter ripple in second passband
1
(default)  realvalued positive scalar
Enter the filter ripple allowed in the second passband in the units you choose for Magnitude units. Values must be real, positive scalars. If you are specifying values in linear units, they must be smaller than 1.
Dependencies
To enable this parameter, set the Order mode to
Minimum
.
Design method — Filter design method
Equiripple
(default)  Kaiser window
 Butterworth
 Chebyshev type I
 Chebyshev type II
 Elliptic
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
.
Scale SOS filter coefficients to reduce chance of overflow — Scale filter coefficients
on
(default)  off
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.
Dependencies
To enable this parameter, set Impulse response to
IIR
.
Density factor — Density factor
16
(default)  positive scalar
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 16
represents a reasonable
balance between the accurate approximation to the ideal filter and the time
to design the filter.
Dependencies
To enable this parameter, set Impulse response to
FIR
and Design
method to Equiripple
.
Phase constraint — Phase constraint
Linear
(default)  Maximum
 Minimum
Specify the phase constraint of the filter as Linear
,
Maximum
, or Minimum
.
Dependencies
To enable this parameter, set Impulse response to
FIR
and Design
method to Equiripple
.
Minimum order — Minimum filter order
Any
(default)  Even
When you select this parameter, the design method determines and designs a minimum order filter to meet your specifications.
Dependencies
To enable this parameter, set Impulse response to
FIR
, Order mode to
Minimum
, and Design
method to Kaiser
window
.
Match exactly — Match passband, stopband, or both
Stopband
(default)  Passband
 Both
Specifies that the resulting filter design matches either the passband, stopband, or both bands.
Dependencies
To enable this parameter, set Impulse response to
IIR
.
Structure — Filter structure
Directform FIR
(default)  Directform FIR transposed
 Directform symmetric FIR
 Cascade minimummultiplier allpass
 Cascade wave digital filter allpass
 Directform I SOS
 Directform I transposed SOS
 Directform II SOS
 Directform II transposed SOS
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.
Use basic elements to enable filter customization — Implement filter with basic Simulink blocks
off
(default)  on
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.
The highlevel implementation provides better compatibility across various filter structures, especially filters that would contain algebraic loops when constructed using basic elements.
Dependencies
When you select this check box, the block 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 of n.
Optimize for negative gains — Use subtraction in Sum blocks instead of negative gains in Gain blocks.
Optimize for unit scale values — Optimize unit scale values
off
(default)  on
Select this check box to scale unit gains between sections in SOS filters.
Dependencies
To enable this parameter, set Impulse response to
IIR
.
Rate options — Enforce singlerate or allow multirate processing
Enforce singlerate
processing
(default)  Allow multirate processing
When the Filter type parameter specifies a multirate filter, select the rate processing rule for the block:
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.
Dependencies
To enable this parameter, set the Impulse
response to FIR
and set
Filter type to a multirate filter.
Use variable names for coefficients — Specify coefficients with MATLAB variables
off
(default)  on
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.
Block Characteristics
Data Types 

Multidimensional Signals 

VariableSize Signals 

Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.
Generate SIMD code using Intel AVX2 code replacement library
Note
Requires Embedded Coder^{®} license
The Bandstop Filter block supports SIMD code generation using Intel AVX2 code replacement library under these conditions:
Impulse response is set to
FIR
.Filter type is set to
Singlerate
.Structure is set to
Directform FIR
orDirectform FIR transposed
.Use basic elements to enable filter customization parameter is not selected.
Input processing is set to
Columns as channels (frame based)
.Input signal has a data type of
single
ordouble
.
Generate SIMD code by leveraging target hardware instruction set extensions
Note
Requires Simulink Coder™ or Embedded Coder license
You can generate SIMD code for the Bandstop Filter block on all Intel^{®} platforms and ARM^{®} Cortex^{®}A processors by using the model configuration parameter Leverage target hardware instruction set extensions under these conditions:
Impulse response is set to
FIR
.Filter type is set to
Singlerate
.Structure is set to
Directform FIR
.Use basic elements to enable filter customization parameter is not selected.
Input processing is set to
Columns as channels (frame based)
.Data type of the input signal is
single
(ARM CortexA processors)Data type of the input signal is
single
ordouble
(Intel platforms)
The SIMD technology significantly improves the performance of the generated code. For more information, see SIMD Code Generation. To generate SIMD code from this block, see:
Version History
Introduced in R2006bR2024a: Bandstop Filter block will be removed
The Bandstop Filter block will be removed in a future release. To design a bandstop filter, use the Bandstop FIR Filter Design or the Bandstop IIR Filter Design blocks. To filter a signal using the bandstop filter, use the Discrete FIR Filter (Simulink), SecondOrder Section Filter, or the FourthOrder Section Filter blocks.
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
 América Latina (Español)
 Canada (English)
 United States (English)
Europe
 Belgium (English)
 Denmark (English)
 Deutschland (Deutsch)
 España (Español)
 Finland (English)
 France (Français)
 Ireland (English)
 Italia (Italiano)
 Luxembourg (English)
 Netherlands (English)
 Norway (English)
 Österreich (Deutsch)
 Portugal (English)
 Sweden (English)
 Switzerland
 United Kingdom (English)