| Contents | Index |
Discrete
The Discrete FIR Filter block independently filters each channel of the input signal with the specified digital 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. The Input processing parameter allows you to specify whether the block treats each element of the input as an independent channel (sample-based processing), or each column of the input as an independent channel (frame-based processing). To perform frame-based processing, you must have a DSP System Toolbox license.
The output dimensions equal those of the input, except when you specify a matrix of filter taps for the Coefficients parameter. When you do so, the output dimensions depend on the number of different sets of filter taps you specify.
The outputs of this block numerically match the outputs of the DSP System Toolbox Digital Filter Design block and of the Signal Processing Toolbox dfilt object.
This block supports the Simulink state logging feature. See States in the Simulink User's Guide for more information.
You can change the filter structure implemented with the Discrete FIR Filter block by selecting one of the following from the Filter structure parameter:
Direct form
Direct form symmetric
Direct form antisymmetric
Direct form transposed
Lattice MA
You must have an available DSP System Toolbox license to run a model with any of these filter structures other than direct form.
The Discrete FIR Filter block initializes the internal filter states to zero by default, which has the same effect as assuming that past inputs and outputs are zero. You can optionally use the Initial states parameter to specify nonzero initial conditions for the filter delays.
To determine the number of initial states you must specify and how to specify them, see the table on valid initial states. The Initial states parameter can take one of the forms described in the next table.
Valid Initial States
| Initial Condition | Description |
|---|---|
Scalar | The block initializes all delay elements in the filter to the scalar value. |
Vector or matrix | Each vector or matrix element specifies a unique initial condition for a corresponding delay element in a corresponding channel:
|
The Discrete FIR Filter block accepts and outputs real and complex signals of any numeric data type supported by Simulink. The block supports the same types for the coefficients.
The following diagrams show the filter structure and the data types used within the Discrete FIR Filter block for fixed-point signals.
You cannot specify the state data type on the block mask for this structure because the input states have the same data types as the input.


You cannot specify the state data type on the block mask for this structure because the input states have the same data types as the input.
It is assumed that the filter coefficients are symmetric. The block only uses the first half of the coefficients for filtering.



You cannot specify the state data type on the block mask for this structure because the input states have the same data types as the input.
It is assumed that the filter coefficients are antisymmetric. The block only uses the first half of the coefficients for filtering.



States are complex when either the inputs or the coefficients are complex.




The Main pane of the Discrete FIR Filter block dialog box appears as follows.

Select whether you want to specify the filter coefficients on the block mask or through an input port.
Select the filter structure you want the block to implement. You must have an available DSP System Toolbox license to run a model with a Discrete FIR Filter block that implements any filter structure other than direct form.
Specify the vector coefficients of the filter's transfer function. Filter coefficients must be specified as a row vector. When you specify a row vector of filter taps, the block applies a single filter to the input. To apply multiple filters to the same input, specify a matrix of coefficients, where each row represents a different set of filter taps. This parameter is visible only when Coefficient source is set to Dialog parameters . For multiple filter, Filter structure must be Direct form, and the input must be a scalar.
Specify whether the block performs sample- or frame-based processing. You can select one of the following options:
Elements as channels (sample based) — Treat each element of the input as an independent channel (sample-based processing).
Columns as channels (frame based) — Treat each column of the input as an independent channel (frame-based processing).
Note Frame-based processing requires a DSP System Toolbox license. For more information, see Sample- and Frame-Based Concepts in the DSP System Toolbox documentation. |
Specify the initial conditions of the filter states. To learn how to specify initial states, see Specifying Initial States.
Specify the time interval between samples. To inherit the sample time, set this parameter to -1. See How to Specify the Sample Time.
The Data Types pane of the Discrete FIR Filter block dialog box appears as follows.

Specify the tap sum data type of a direct form symmetric or direct form antisymmetric filter, which is the data type the filter uses when it sums the inputs prior to multiplication by the coefficients. You can set it to:
A rule that inherits a data type, for example, Inherit: Inherit via internal rule
A built-in integer, for example, int8
A data type object, for example, a Simulink.NumericType object
An expression that evaluates to a data type, for example, fixdt(1,16,0)
This parameter is only visible when the selected filter structure is either Direct form symmetric or Direct form antisymmetric.
Click the Show data type assistant button
to display the Data
Type Assistant, which helps you set the Tap sum parameter.
See Using the Data Type Assistant for more information.
Specify the coefficient data type. You can set it to:
A rule that inherits a data type, for example, Inherit: Same word length as input
A built-in integer, for example, int8
A data type object, for example, a Simulink.NumericType object
An expression that evaluates to a data type, for example, fixdt(1,16,0)
Click the Show data type assistant button
to display the Data
Type Assistant, which helps you set the Coefficients parameter.
See Using the Data Type Assistant for more information.
Specify the minimum value that a filter coefficient should have. The default value is [] (unspecified). Simulink software uses this value to perform:
Parameter range checking (see Checking Parameter Values)
Automatic scaling of fixed-point data types
Specify the maximum value that a filter coefficient should have. The default value is [] (unspecified). Simulink software uses this value to perform:
Parameter range checking (see Checking Parameter Values)
Automatic scaling of fixed-point data types
Specify the product output data type. You can set it to:
A rule that inherits a data type, for example, Inherit: Inherit via internal rule
A built-in data type, for example, int8
A data type object, for example, a Simulink.NumericType object
An expression that evaluates to a data type, for example, fixdt(1,16,0)
Click the Show data type assistant button
to display the Data
Type Assistant, which helps you set the Product
output parameter.
See Using the Data Type Assistant for more information.
Specify the accumulator data type. You can set it to:
A rule that inherits a data type, for example, Inherit: Inherit via internal rule
A built-in data type, for example, int8
A data type object, for example, a Simulink.NumericType object
An expression that evaluates to a data type, for example, fixdt(1,16,0)
Click the Show data type assistant button
to display the Data
Type Assistant, which helps you set the Accumulator parameter.
See Using the Data Type Assistant for more information.
Specify the state data type. You can set it to:
A rule that inherits a data type, for example, Inherit: Same as accumulator
A built-in integer, for example, int8
A data type object, for example, a Simulink.NumericType object
An expression that evaluates to a data type, for example, fixdt(1,16,0)
This parameter is only visible when the selected filter structure is Lattice MA.
Click the Show data type assistant button
to display the Data
Type Assistant, which helps you set the State parameter.
See Using the Data Type Assistant for more information.
Specify the output data type. You can set it to:
A rule that inherits a data type, for example, Inherit: Same as accumulator
A built-in data type, for example, int8
A data type object, for example, a Simulink.NumericType object
An expression that evaluates to a data type, for example, fixdt(1,16,0)
Click the Show data type assistant button
to display the Data
Type Assistant, which helps you set the Output parameter.
See Specifying Block Output Data Types for more information.
Specify the minimum value that the block should output. The default value is [] (unspecified). Simulink software uses this value to perform:
Simulation range checking (see Signal Ranges)
Automatic scaling of fixed-point data types
Specify the maximum value that the block should output. The default value is [] (unspecified). Simulink software uses this value to perform:
Simulation range checking (see Signal Ranges)
Automatic scaling of fixed-point data types
Select to lock all data type settings of this block against changes by the Fixed-Point Tool and the Fixed-Point Advisor. For more information, see Fixed-Point Tool and Fixed-Point Advisor in the Simulink Fixed Point documentation.
Specify the rounding mode for fixed-point operations. For more information, see Rounding in the Simulink Fixed Point User's Guide.
| Action | Reasons for Taking This Action | What Happens for Overflows | Example |
|---|---|---|---|
Select this check box. | Your model has possible overflow and you want explicit saturation protection in the generated code. | Overflows saturate to either the minimum or maximum value that the data type can represent. | An overflow associated with a signed 8-bit integer can saturate to -128 or 127. |
Do not select this check box. | You want to optimize efficiency of your generated code. You want to avoid overspecifying how a block handles out-of-range signals. For more information, see Checking for Signal Range Errors. | Overflows wrap to the appropriate value that is representable by the data type. | The number 130 does not fit in a signed 8-bit integer and wraps to -126. |
When you select this check box, saturation applies to every internal operation on the block, not just the output or result. In general, the code generation process can detect when overflow is not possible. In this case, the code generator does not produce saturation code.
Direct Feedthrough | Yes |
Sample Time | Specified in the Sample time parameter |
Scalar Expansion | Yes, of initial states |
States | |
Dimensionalized | Yes |
Zero-Crossing Detection | No |

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |