Filter each channel of input over time using static or time-varying digital filter implementations
Filtering / Filter Implementations
dsparch4
Note
Use of Digital Filter block in future releases is not recommended. Existing instances will continue to operate, but certain functionality will be disabled. See Functionality being removed or replaced for blocks and System objects. We strongly recommend using one of Discrete FIR Filter (Simulink), Discrete Filter (Simulink), Biquad Filter, or Allpole Filter in new designs.
You can use the Digital Filter block to efficiently implement a floating-point or
fixed-point filter for which you know the coefficients, or that is already defined in a
dfilt
object. The block independently
filters each channel of the input signal with a specified digital IIR or FIR filter. The
block can implement static filters with fixed coefficients, as well
as time-varying filters with coefficients that change over time.
You can tune the coefficients of a static filter during simulation.
This block filters each channel of the input signal independently over time. You must set the Input processing parameter to specify how the block interprets the input signal. You can select one of the following options:
Columns as channels (frame based)
— When you
select this option, the block treats each column of the input as an independent
channel.
Elements as channels (sample based)
— When
you select this option, the block treats each element of the input as an
individual channel.
The output dimensions always match those of the input signal. The outputs of this
block numerically match the outputs of the Digital Filter Design block and of the dfilt
object.
Note
The Digital Filter block has direct feedthrough, so if you connect the output of this block back to its input you get an algebraic loop. For more information on direct feedthrough and algebraic loops, see Algebraic Loop Concepts (Simulink).
The Digital Filter block can operate in three different modes. Select the mode in the Coefficient source group box.
Dialog parameters Enter information about the filter such as structure and coefficients in the block mask.
Input port(s) Enter the filter structure in the block mask, and the filter coefficients come in through one or more block ports. This mode is useful for specifying time-varying filters.
Discrete-time filter object (DFILT) Specify
the filter using a dfilt
object.
When you select Discrete-time filter object (DFILT), the
following dfilt
structures are supported:
When you select Dialog parameters or Input
port(s), the list of filter structures offered in the
Filter structure parameter depends on whether you set the
Transfer function type to IIR (poles &
zeros)
, IIR (all poles)
, or
FIR (all zeros)
, as summarized in the following
table.
Note
Each structure listed in the table below supports both fixed-point and floating-point signals.
The table also shows the vector or matrix of filter coefficients you must provide for each filter structure.
Filter Structures and Filter Coefficients
Transfer Function Type | Supported Filter Structures | Filter Coefficient Specification |
---|---|---|
IIR (poles & zeros) |
|
See Special Consideration for the Leading Denominator Coefficient. |
|
| |
IIR (all poles) |
| Denominator coefficients vector [a0, a1, a2, ..., am] See Special Consideration for the Leading Denominator Coefficient. |
| Reflection coefficients vector [k1, k2, ..., kn] | |
FIR (all zeros) |
| Numerator coefficients vector [b0, b1, b2, ..., bn] |
| Reflection coefficients vector [k1, k2, ..., kn] |
In some cases, the Digital Filter block requires the leading denominator
coefficient (a0
) to be 1. This
requirement applies under the following conditions:
The Digital Filter block is operating in a fixed-point mode. The block operates in a fixed-point mode when at least one of the following statements is true:
The input to the Digital Filter block has a fixed-point or integer data type.
The Fixed-point instrumentation mode
parameter under Analysis > Fixed Point
Tool has a setting of Minimums,
maximums and overflows
.
The Coefficient source has a setting of
Dialog
or Input
port(s)
.
Note
If you are working in one of the fixed-point situations
described in the previous bullet, and the Coefficient
source is set to Input
port(s)
, you must select the First
denominator coefficient = 1, remove a0 term in the
structure check box.
The Transfer function type and Filter structure parameters are set to one of the combinations described in the following table.
Transfer function type | Filter structure |
---|---|
IIR (poles & zeros) |
|
| |
| |
| |
IIR (all poles) |
|
|
The Digital Filter block produces an error if you use it in one of the these
configurations and your leading denominator coefficient
(a0
) does not equal 1. To
resolve the error, set your leading denominator coefficient to 1 by scaling all
numerator and denominator coefficients by a factor of
a0
.
In Dialog parameters and Input port(s) modes, the block initializes the internal filter states to zero by default, which is equivalent to assuming past inputs and outputs are zero. You can optionally use the Initial conditions parameter to specify nonzero initial conditions for the filter delays.
To determine the number of initial condition values you must specify, and how to specify them, see the following table on Valid Initial Conditions and Number of Delay Elements (Filter States). The Initial conditions parameter can take one of four forms as described in the following table.
Valid Initial Conditions
Initial Condition | Examples | Description |
---|---|---|
Scalar |
Each delay element for
each channel is set to | The block initializes all delay elements in the filter to the scalar value. |
Vector | For a filter with two delay elements: [d1 d2] The delay elements for all channels are d1 and d2. | Each vector element specifies a unique initial condition for a corresponding delay element. The block applies the same vector of initial conditions to each channel of the input signal. The vector length must equal the number of delay elements in the filter (specified in the table Number of Delay Elements (Filter States)). |
Vector or matrix | For a 3-channel input signal and a filter with two delay elements: [d1 d2 D1 D2 d1 d2] or
| Each vector or matrix element specifies a unique initial condition for a corresponding delay element in a corresponding channel:
|
Empty matrix |
| The empty matrix, |
The number of delay elements (filter states) per input channel depends on the filter structure, as indicated in the following table.
Number of Delay Elements (Filter States)
Filter Structure | Number of Delay Elements per Channel |
---|---|
|
|
|
|
|
|
|
|
|
|
Simulink® enables you to log the states in your model to the MATLAB® workspace. The following table indicates which filter structures of the Digital Filter block support the Simulink state logging feature. See State (Simulink) for more information.
Transfer Function Type | Filter Structure | State Logging Supported |
---|---|---|
IIR (poles & zeros) | Direct form I | No |
Direct form I transposed | Yes | |
Direct form II | No | |
Direct form II transposed | Yes | |
Biquadratic direct form I
(SOS) | Yes | |
Biquadratic direct form I transposed
(SOS) | Yes | |
Biquadratic direct form II
(SOS) | Yes | |
Biquadratic direct form II transposed
(SOS) | Yes | |
IIR (all poles) | Direct form | No |
Direct form transposed | Yes | |
Lattice AR | Yes | |
FIR (all zeros) | Direct form | No |
Direct form symmetric | No | |
Direct form antisymmetric | No | |
Direct form transposed | Yes | |
Lattice MA | Yes |
All structures supported by the Digital Filter block support fixed-point data types. You can specify intermediate fixed-point data types for quantities such as the coefficients, accumulator, and product output for each filter structure. See Filter Structure Diagrams for diagrams depicting the use of these intermediate fixed-point data types in each filter structure.
The Digital Filter block can operate in three different modes. Select the mode in the Coefficient source group box.
Dialog parameters Enter information about the filter such as structure and coefficients in the block mask.
Input port(s) Enter the filter structure in the block mask, and the filter coefficients come in through one or more block ports. This mode is useful for specifying time-varying filters.
Discrete-time filter object (DFILT) Specify
the filter using a dfilt
object.
Different items appear on the Digital Filter block dialog depending on whether you select Dialog parameters, Input port(s), or Discrete-time filter object (DFILT) in the Coefficient source group box. See the following sections for details:
The Main pane of the Digital Filter block dialog appears as follows when Dialog parameters is specified in the Coefficient source group box. The parameters below can appear when Dialog parameters or Input port(s) is selected, as noted.
Select the type of transfer function of the filter; IIR
(poles & zeros)
, IIR (all
poles)
, or FIR (all zeros)
.
See Supported Filter Structures for more information.
Select the filter structure. The selection of available structures varies depending the setting of the Transfer function type parameter. See Supported Filter Structures for more information.
Specify the vector of numerator coefficients of the filter's transfer function.
This parameter is only visible when Dialog parameters is selected and when the selected filter structure lends itself to specification with numerator coefficients. Tunable (Simulink).
Specify the vector of denominator coefficients of the filter's transfer function.
In some cases, the leading denominator coefficient (a0) must be 1. See Special Consideration for the Leading Denominator Coefficient for more information.
This parameter is only visible when Dialog parameters is selected and when the selected filter structure lends itself to specification with denominator coefficients. Tunable (Simulink).
Specify the vector of reflection coefficients of the filter's transfer function.
This parameter is only visible when Dialog parameters is selected and when the selected filter structure lends itself to specification with reflection coefficients. Tunable (Simulink).
Specify an M-by-6 SOS matrix
containing coefficients of a second-order section (SOS) filter, where
M is the number of sections. You can use the
ss2sos
and tf2sos
functions from
Signal Processing Toolbox™ software to check whether your SOS matrix is valid.
This parameter is only visible when Dialog parameters is selected and when the selected filter structure is biquadratic. Tunable (Simulink).
Specify the scale values to be applied before and after each section of a biquadratic filter.
If you specify a scalar, that value is applied before the first filter section. The rest of the scale values are set to 1.
You can also specify a vector with M + 1 elements, assigning a different value to each scale. See Filter Structure Diagrams for diagrams depicting the use of scale values in biquadratic filter structures.
This parameter is only visible when Dialog parameters is selected and when the selected filter structure is biquadratic. Tunable (Simulink).
Select this parameter to reduce the number of computations the block
must make to produce the output by omitting the 1
/
a
0 term in the filter
structure. The block output is invalid if you select this parameter when
the first denominator filter coefficient is not
always 1 for your time-varying filter.
This parameter is only enabled when the Input port(s) is selected and when the selected filter structure lends itself to this specification.
Specify how often the block updates time-varying filters; once per sample or once per frame.
This parameter appears only when the following conditions are met:
You specify Input port(s) in the Coefficient source group box.
You set the Input processing parameter to
Columns as channels (frame
based)
.
Specify the initial conditions of the filter states. To learn how to specify initial conditions, see Specifying Initial Conditions.
(Not shown in dialog above.) Specify the initial conditions for the filter states on the side of the filter structure with the zeros (b0, b1,b2, ...); see the diagram below.
This parameter is enabled only when the filter has both poles and zeros, and when you select a structure such as direct form I, which has separate filter states corresponding to the poles (ak) and zeros (bk). To learn how to specify initial conditions, see Specifying Initial Conditions.
(Not shown in dialog above). Specify the initial conditions for the filter states on the side of the filter structure with the poles (a0, a1,a2, ...); see the diagram below.
This parameter is enabled only when the filter has both poles and zeros, and when you select a structure such as direct form I, which has separate filter states corresponding to the poles (ak) and zeros (bk). To learn how to specify initial conditions, see Specifying Initial Conditions.
Specify how the block should process the input. 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 Inherited (this choice will be removed - see
release notes)
option will be removed in a future release.
See Frame-Based Processing in
the DSP System Toolbox™ Release Notes for
more information.
This button opens the Filter Visualization Tool (fvtool
) from the
Signal Processing Toolbox product and displays the filter response of the filter
defined by the block. For more information on FVTool, see the
Signal Processing Toolbox documentation.
Note
If you specify a filter in the Filter parameter, you must click the Apply button to apply the filter before using the View filter response button.
The Data Types pane of the Digital Filter block dialog appears as follows when Dialog parameters is specified in the Coefficient source group box. The parameters below can appear when Dialog parameters or Input port(s) is selected, depending on the filter structure and whether the coefficients are being entered via ports or on the block mask.
Select the rounding
mode for fixed-point operations. The filter coefficients do
not obey this parameter; they always round to
Nearest
.
Select the overflow mode for fixed-point operations. The filter coefficients do not obey this parameter; they are always saturated.
Choose how you specify the word length and the fraction length of the fixed-point data type going into and coming out of each section of a biquadratic filter. See Filter Structure Diagrams for illustrations depicting the use of the section I/O data type in this block.
This parameter is only visible when the selected filter structure is biquadratic:
When you select Same as input
,
these characteristics match those of the input to the
block.
When you select Binary point
scaling
, you can enter the word and fraction
lengths of the section input and output, in bits.
When you select Slope and bias
scaling
, you can enter the word lengths, in
bits, and the slopes of the section input and output. This block
requires power-of-two slope and a bias of zero.
Choose how you specify the word length and the fraction length of the tap sum data type of a direct form symmetric or direct form antisymmetric filter. See Filter Structure Diagrams for illustrations depicting the use of the tap sum data type in this block.
This parameter is only visible when the selected filter structure is
either Direct form symmetric
or
Direct form antisymmetric
:
When you select Same as input
,
these characteristics match those of the input to the
block.
When you select Binary point
scaling
, you can enter the word length and the
fraction length of the tap sum accumulator, in bits.
When you select Slope and bias
scaling
, you can enter the word length, in
bits, and the slope of the tap sum accumulator. This block
requires power-of-two slope and a bias of zero.
Choose how you specify the word length and the fraction length of the multiplicand data type of a direct form I transposed or biquadratic direct form I transposed filter. See Filter Structure Diagrams for illustrations depicting the use of the multiplicand data type in this block.
This parameter is only visible when the selected filter structure is
either Direct form I transposed
or
Biquad direct form I transposed
(SOS)
:
When you select Same as output
,
these characteristics match those of the output to the
block.
When you select Binary point
scaling
, you can enter the word length and the
fraction length of the multiplicand data type, in bits.
When you select Slope and bias
scaling
, you can enter the word length, in
bits, and the slope of the multiplicand data type. This block
requires power-of-two slope and a bias of zero.
Choose how you specify the word length and the fraction length of the filter coefficients (numerator and/or denominator). See Filter Structure Diagrams for illustrations depicting the use of the coefficient data types in this block:
When you select Same word length as
input
, the word length of the filter
coefficients match that of the input to the block. In this mode,
the fraction length of the coefficients is automatically set to
the binary-point only scaling that provides you with the best
precision possible given the value and word length of the
coefficients.
When you select Specify word
length
, you can enter the word length of the
coefficients, in bits. In this mode, the fraction length of the
coefficients is automatically set to the binary-point only
scaling that provides you with the best precision possible given
the value and word length of the coefficients.
When you select Binary point
scaling
, you can enter the word length and the
fraction length of the coefficients, in bits. If applicable, you
can enter separate fraction lengths for the numerator and
denominator coefficients.
When you select Slope and bias
scaling
, you can enter the word length, in
bits, and the slope of the coefficients. If applicable, you can
enter separate slopes for the numerator and denominator
coefficients. This block requires power-of-two slope and a bias
of zero.
The filter coefficients do not obey the Rounding
mode and the Overflow mode
parameters; they are always saturated and rounded to
Nearest
.
Use this parameter to specify how you would like to designate the product output word and fraction lengths. See Filter Structure Diagrams and Multiplication Data Types for illustrations depicting the use of the product output data type in this block:
When you select Same as input
,
these characteristics match those of the input to the
block.
When you select Binary point
scaling
, you can enter the word length and the
fraction length of the product output, in bits.
When you select Slope and bias
scaling
, you can enter the word length, in
bits, and the slope of the product output. This block requires
power-of-two slope and a bias of zero.
Use this parameter to specify how you would like to designate the accumulator word and fraction lengths. See Filter Structure Diagrams and Multiplication Data Types for illustrations depicting the use of the accumulator data type in this block:
When you select Same as input
,
these characteristics match those of the input to the
block.
When you select Same as product
output
, these characteristics match those of
the product output.
When you select Binary point
scaling
, you can enter the word length and the
fraction length of the accumulator, in bits.
When you select Slope and bias
scaling
, you can enter the word length, in
bits, and the slope of the accumulator. This block requires
power-of-two slope and a bias of zero.
Use this parameter to specify how you would like to designate the state word and fraction lengths. See Filter Structure Diagrams for illustrations depicting the use of the state data type in this block.
This parameter is not visible for direct form and direct form I filter structures.
When you select Same as input
,
these characteristics match those of the input to the
block.
When you select Same as
accumulator
, these characteristics match those of
the accumulator.
When you select Binary point
scaling
, you can enter the word length and the
fraction length of the accumulator, in bits.
When you select Slope and bias
scaling
, you can enter the word length, in
bits, and the slope of the accumulator. This block requires
power-of-two slope and a bias of zero.
Choose how you specify the output word length and fraction length:
When you select Same as input
,
these characteristics match those of the input to the
block.
When you select Same as
accumulator
, these characteristics match those of
the accumulator.
When you select Binary point
scaling
, you can enter the word length and the
fraction length of the output, in bits.
When you select Slope and bias
scaling
, you can enter the word length, in
bits, and the slope of the output. This block requires
power-of-two slope and a bias of zero.
Select this parameter to prevent the fixed-point tools from overriding the data types you specify on the block mask.
The Main pane of the Digital Filter block dialog appears as follows when Discrete-time filter object (DFILT) is specified in the Coefficient source group box.
Specify the discrete-time filter object (dfilt
) that you would
like the block to implement. You can do this in one of three
ways:
You can fully specify the dfilt
object in
the block mask, as shown in the default value.
You can enter the variable name of a
dfilt
object that is defined in any
workspace.
You can enter a variable name for a dfilt
object that is not yet defined.
Specify how the block should process the input. 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 Inherited (this choice will be removed - see
release notes)
option will be removed in a future release.
See Frame-Based Processing in
the DSP System Toolbox Release Notes for
more information.
This button opens the Filter Visualization Tool (fvtool
) from the
Signal Processing Toolbox product and displays the filter response of the dfilt
object specified in
the Filter parameter. For more information on
FVTool, see the Signal Processing Toolbox documentation.
Note
If you specify a filter in the Filter parameter, you must click the Apply button to apply the filter before using the View filter response button.
The Data Types pane of the Digital Filter block dialog appears as follows when Discrete-time filter object (DFILT) is specified in the Coefficient source group box.
The fixed-point settings of the filter object specified on the Main pane are displayed on the Data Types pane. You cannot change these settings directly on the block mask. To change the fixed-point settings you must edit the filter object directly.
For more information on discrete-time filter objects, see the dfilt
reference page.
The diagrams in the following sections show the filter structures supported by the Digital Filter block. They also show the data types used in the filter structures for fixed-point signals. You can set the coefficient, output, accumulator, product output, and state data types shown in these diagrams in the block dialog. This is discussed in Dialog Box.
The following constraints are applicable when processing a fixed-point signal with this filter structure:
Inputs can be real or complex.
Numerator and denominator coefficients can be real or complex.
Numerator and denominator coefficients must be the same complexity as each other.
When the numerator and denominator coefficients are specified via input ports and have different complexities from each other, you get an error.
When the numerator and denominator coefficients are specified in the dialog and have different complexities from each other, the block does not error, but instead processes the filter as if two sets of complex coefficients are provided. The coefficient set that is real-valued is treated as if it is a complex vector with zero-valued imaginary parts.
Numerator and denominator coefficients must have the same word length. They can have different fraction lengths.
The State data type cannot be specified on the block mask for this structure, because the input and output states have the same data types as the input and output buffers.
The following constraints are applicable when processing a fixed-point signal with this filter structure:
Inputs can be real or complex.
Numerator and denominator coefficients can be real or complex.
Numerator and denominator coefficients must be the same complexity as each other.
When the numerator and denominator coefficients are specified via input ports and have different complexities from each other, you get an error.
When the numerator and denominator coefficients are specified in the dialog and have different complexities from each other, the block does not error, but instead processes the filter as if two sets of complex coefficients are provided. The coefficient set that is real-valued is treated as if it is a complex vector with zero-valued imaginary parts.
States are complex when either the input or the coefficients are complex.
Numerator and denominator coefficients must have the same word length. They can have different fraction lengths.
The following constraints are applicable when processing a fixed-point signal with this filter structure:
Inputs can be real or complex.
Numerator and denominator coefficients can be real or complex.
Numerator and denominator coefficients must be the same complexity as each other.
When the numerator and denominator coefficients are specified via input ports and have different complexities from each other, you get an error.
When the numerator and denominator coefficients are specified in the dialog and have different complexities from each other, the block does not error, but instead processes the filter as if two sets of complex coefficients are provided. The coefficient set that is real-valued is treated as if it is a complex vector with zero-valued imaginary parts.
States are complex when either the inputs or the coefficients are complex.
Numerator and denominator coefficients must have the same word length. They can have different fraction lengths.
The following constraints are applicable when processing a fixed-point signal with this filter structure:
Inputs can be real or complex.
Numerator and denominator coefficients can be real or complex.
Numerator and denominator coefficients must be the same complexity as each other.
When the numerator and denominator coefficients are specified via input ports and have different complexities from each other, you get an error.
When the numerator and denominator coefficients are specified in the dialog and have different complexities from each other, the block does not error, but instead processes the filter as if two sets of complex coefficients are provided. The coefficient set that is real-valued is treated as if it is a complex vector with zero-valued imaginary parts.
States are complex when either the inputs or the coefficients are complex.
Numerator and denominator coefficients must have the same word length. They can have different fraction lengths.
The following constraints are applicable when processing a fixed-point signal with this filter structure:
Inputs and coefficients can be real or complex.
Numerator and denominator coefficients can be real or complex.
Specify the coefficients by a M-by-6 matrix in the block mask. You cannot specify coefficients by input ports for this filter structure.
When the a0 element of any row is not equal to one, that row is normalized by a0 prior to filtering.
States are complex when either the inputs or the coefficients are complex.
You cannot specify the state data type on the block mask for this structure, because the input and output states have the same data types as the input.
Scale values must have the same complexity as the coefficient SOS matrix.
The scale value parameter must be a scalar or a vector of length M+1, where M is the number of sections.
The Section I/O parameter determines the data type for the section input and output data types. The section input and stage output data type must have the same word length but can have different fraction lengths.
The following diagram shows the data types for one section of the filter.
The following diagram shows the data types between filter sections.
The following constraints are applicable when processing a fixed-point signal with this filter structure:
Inputs and coefficients can be real or complex.
Numerator and denominator coefficients can be real or complex.
Specify the coefficients by a M-by-6 matrix in the block mask. You cannot specify coefficients by input ports for this filter structure.
When the a0 element of any row is not equal to one, that row is normalized by a0 prior to filtering.
States are complex when either the inputs or the coefficients are complex.
Scale values must have the same complexity as the coefficient SOS matrix.
The scale value parameter must be a scalar or a vector of length M+1, where M is the number of sections.
The Section I/O parameter determines the data type for the section input and output data types. The section input and section output data type must have the same word length but can have different fraction lengths.
The following diagram shows the data types for one section of the filter.
The following diagram shows the data types between filter sections.
The following constraints are applicable when processing a fixed-point signal with this filter structure:
Inputs and coefficients can be real or complex.
Numerator and denominator coefficients can be real or complex.
Specify the coefficients by a M-by-6 matrix in the block mask. You cannot specify coefficients by input ports for this filter structure.
When the a0 element of any row is not equal to one, that row is normalized by a0 prior to filtering.
States are complex when either the inputs or the coefficients are complex.
Scale values must have the same complexity as the coefficient SOS matrix.
The scale value parameter must be a scalar or a vector of length M+1, where M is the number of sections.
The Section I/O parameter determines the data type for the section input and output data types. The section input and section output data type must have the same word length but can have different fraction lengths.
The following diagram shows the data types for one section of the filter.
The following diagram shows the data types between filter sections.
The following constraints are applicable when processing a fixed-point signal with this filter structure:
Inputs and coefficients can be real or complex.
Numerator and denominator coefficients can be real or complex.
Specify the coefficients by a M-by-6 matrix in the block mask. You cannot specify coefficients by input ports for this filter structure.
When the a0 element of any row is not equal to one, that row is normalized by a0 prior to filtering.
States are complex when either the inputs or the coefficients are complex.
Scale values must have the same complexity as the coefficient SOS matrix.
The scale value parameter must be a scalar or a vector of length M+1, where M is the number of sections.
The Section I/O parameter determines the data type for the section input and output data types. The section input and section output data type must have the same word length but can have different fraction lengths.
The following diagram shows the data types for one section of the filter.
The following diagram shows the data types between filter sections.
The following constraints are applicable when processing a fixed-point signal with this filter structure:
Inputs and coefficients can be real or complex.
Denominator coefficients can be real or complex.
You cannot specify the state data type on the block mask for this structure, because the input and output states have the same data types as the input.
The following constraints are applicable when processing a fixed-point signal with this filter structure:
Inputs and coefficients can be real or complex.
Denominator coefficients can be real or complex.
The following constraints are applicable when processing a fixed-point signal with this filter structure:
Inputs and coefficients can be real or complex.
Coefficients can be real or complex.
The following constraints are applicable when processing a fixed-point signal with this filter structure:
Inputs can be real or complex.
Numerator coefficients can be real or complex.
You cannot specify the state data type on the block mask for this structure, because the input and output states have the same data types as the input.
The following constraints are applicable when processing a fixed-point signal with this filter structure:
Inputs can be real or complex.
Numerator coefficients can be real or complex.
You cannot specify the state data type on the block mask for this structure, because the input and output states have the same data types as the input.
It is assumed that the filter coefficients are symmetric. Only the first half of the coefficients are used for filtering.
The Tap Sum parameter determines the data type the filter uses when it sums the inputs prior to multiplication by the coefficients.
The following constraints are applicable when processing a fixed-point signal with this filter structure:
Inputs can be real or complex.
Numerator coefficients can be real or complex.
You cannot specify the state data type on the block mask for this structure, because the input and output states have the same data types as the input.
It is assumed that the filter coefficients are antisymmetric. Only the first half of the coefficients are used for filtering.
The Tap Sum parameter determines the data type the filter uses when it sums the inputs prior to multiplication by the coefficients.
The following constraints are applicable when processing a fixed-point signal with this filter structure:
Inputs can be real or complex.
Coefficients can be real or complex.
States are complex when either the inputs or the coefficients are complex.
The following constraints are applicable when processing a fixed-point signal with this filter structure:
Inputs and coefficients can be real or complex.
Coefficients can be real or complex.
HDL Coder™ provides additional configuration options that affect HDL implementation and synthesized logic.
Note
Use of Digital Filter block in future releases is not recommended. Existing instances will continue to operate, but certain functionality will be disabled. See Functionality being removed or replaced for blocks and System objects. We strongly recommend using Discrete FIR Filter (Simulink) or Biquad Filter in new designs.
When you specify SerialPartition
and
ReuseAccum
for a Digital Filter block, observe
the following constraints.
If you specify Dialog parameters as the
Coefficient source
:
Set Transfer function type to
FIR (all
zeros)
.
Select Filter structure as one of:
Direct form
, Direct form
symmetric
, or Direct form
asymmetric
.
Distributed Arithmetic properties DALUTPartition and
DARadix are supported for the
default
architecture, with FIR, Asymmetric FIR,
and Symmetric FIR filter structures.
When you use AddPipelineRegisters, registers are placed based on the filter structure. The pipeline register placement determines the latency.
Architecture | Pipeline Register Placement | Latency (clock cycles) |
---|---|---|
FIR, Asymmetric FIR, and Symmetric FIR filters | A pipeline register is added between levels of a tree-based adder. | ceil(log2(FL)) .
FL is the filter
length. |
FIR Transposed | A pipeline register is added after the products. | 1 |
IIR SOS | Pipeline registers are added between the filter sections. | NS-1 .
NS is the number of
sections. |
AddPipelineRegisters | Insert a pipeline register between stages of computation in a filter. See also AddPipelineRegisters (HDL Coder). |
CoeffMultipliers | Specify the use of canonical signed digit (CSD) optimization to decrease filter area
by replacing coefficient multipliers with shift-and-add logic. When you choose a fully
parallel filter implementation, you can set CoeffMultipliers to
|
DALUTPartition | Specify distributed arithmetic partial-product LUT partitions as a vector of the sizes of each partition. The sum of all vector elements must be equal to the filter length. The maximum size for a partition is 12 taps. Set DALUTPartition to a scalar value equal to the filter length to generate DA code without LUT partitions. See also DALUTPartition (HDL Coder). |
MultiplierInputPipeline | Specify the number of pipeline stages to add at filter multiplier inputs. See also MultiplierInputPipeline (HDL Coder). |
MultiplierOutputPipeline | Specify the number of pipeline stages to add at filter multiplier outputs. See also MultiplierOutputPipeline (HDL Coder). |
ReuseAccum | Enable or disable accumulator reuse in a serial filter implementation.
Set ReuseAccum to |
ConstrainedOutputPipeline | Number of registers to place at
the outputs by moving existing delays within your design. Distributed
pipelining does not redistribute these registers. The default is
|
InputPipeline | Number of input pipeline stages
to insert in the generated code. Distributed pipelining and constrained
output pipelining can move these registers. The default is
|
OutputPipeline | Number of output pipeline stages
to insert in the generated code. Distributed pipelining and constrained
output pipelining can move these registers. The default is
|
Except for decimator and interpolator filter structures, HDL Coder supports use of complex coefficients and complex input signals for all filter structures of the Digital Filter block.
You must set Initial conditions to zero. HDL code generation is not supported for nonzero initial states.
HDL Coder does not support the Digital Filter block Input port(s) option for HDL code generation.
Double-precision floating point
Single-precision floating point
Fixed point (signed only)
8-, 16-, and 32-bit signed integers
Allpole Filter | DSP System Toolbox |
Digital Filter Design | DSP System Toolbox |
Biquad Filter | DSP System Toolbox |
Discrete Filter (Simulink) | Simulink |
Discrete FIR Filter (Simulink) | Simulink |
Filter Realization Wizard | DSP System Toolbox |
dfilt | DSP System Toolbox |
filterDesigner | DSP System Toolbox |
fvtool | Signal Processing Toolbox |