Fixed-Point Blockset    
FIR

Implement a fixed-point finite impulse response (FIR) filter

Library

Filters

Description

The FIR block is a masked S-function that samples and holds the N most recent inputs, multiplies each input by a specified value (its FIR coefficient), and stacks them in a vector. This block supports both single-input/single-output (SISO) and single-input/multi-output (SIMO) modes.

For the SISO mode, the FIR coefficients parameter is specified as a row vector. For the SIMO mode, the FIR coefficients are specified as a matrix where each row corresponds to a separate output.

The Initial condition parameter provides the initial values for all times preceding the start time in the FIR realization. You specify the time interval between samples with the Sample time parameter.

You can choose whether or not to specify the data type and scaling of the FIR coefficients in the dialog with the Gain data type and scaling parameter. If you select Specify via dialog for this parameter, the Parameter data type and Parameter scaling parameters become visible.

You can specify the scaling for the FIR coefficients with the Parameter scaling parameter. Note that there are two dialog box parameters that control the FIR coefficient scaling: one associated with an edit field, and one associated with a parameter list. If Parameter data type is a generalized fixed-point number such as sfix(16), the Parameter scaling list provides you with these scaling modes:

If the FIR coefficients are specified as a row vector, then scaling element-wise and column-wise produce the same result, while scaling matrix-wise and row-wise produce the same result.

For a detailed description of all other block parameters, refer to Block Parameters.

Parameters and Dialog Box

FIR coefficients
FIR coefficients. One row per output.
Initial condition
Initial values for all times preceding the start time.
Sample time
Sample time.
Gain data type and scaling
Choose whether to specify the data type of the FIR coefficients via the dialog or via an internal rule. If Specify via dialog is selected, the Parameter data type and Parameter scaling parameters become visible.
Parameter data type
Any data type supported by the Fixed-Point Blockset. This parameter is only visible if Specify via dialog is selected for the Gain data type and scaling parameter.
Parameter scaling
Set the parameter scaling using radix point-only or [Slope Bias] scaling. Additionally, the FIR coefficients vector or matrix can be scaled using the constant vector or constant matrix scaling modes for maximizing precision. These scaling modes are available only for generalized fixed-point data types. This parameter is only visible if Specify via dialog is selected for the Gain data type and scaling parameter.
Parameter scaling
This drop-down list enables you to specify the parameter scaling in the dialog or by an inherited rule. This parameter is only visible if Specify via dialog is selected for the Gain data type and scaling parameter.
Output data type and scaling
Specify the output data type and scaling via the dialog box, or inherit the data type and scaling from the driving block or by backpropagation.
Output data type
Any data type supported by the Fixed-Point Blockset.
Output scaling
Set the output scaling using radix point-only or [Slope Bias] scaling. These scaling modes are available only for generalized fixed-point data types.
Lock output scaling so autoscaling tool can't change it
If selected, Output scaling is locked. This feature is available only for generalized fixed-point output.
Round toward
Rounding mode for the fixed-point output.
Saturate to max or min when overflows occur
If selected, fixed-point overflows saturate.

Conversions and Operations

The FIR coefficients parameter is converted from doubles to the specified data type offline using round-to-nearest and saturation.The Initial condition parameter is converted from doubles to the input data type offline using round-to-nearest and saturation. Refer to Parameter Conversions for more information about parameter conversions.

The FIR block first multiplies its inputs by the FIR coefficients parameter, converts those results to the output data type using the specified rounding and overflow modes, and then carries out the summation. Refer to Rules for Arithmetic Operations for more information about the rules this block adheres to when performing operations.

Examples

Suppose you want to configure this block for two outputs (SIMO mode) where the first output is given by

the second output is given by

and the initial values of u(k - 1) and u(k - 2) are given by ic1 and ic2, respectively. To configure the FIR block for this situation, you must specify the FIR coefficient parameter as [a1 b1 c1; a2 b2 c2] where c2 = 0, and the Initial condition parameter as [ic1 ic2].

Characteristics

Input Ports
Any data type supported by the blockset--it must be a scalar
Output Port
Any data type supported by the blockset
Direct Feedthrough
Yes
Scalar Expansion
Of initial conditions
Vectorized
No


  Filter Real Zero Gain