Skip to content

FixPt FIR

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

Description

The FixPt 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.

Dialog Box Parameters

  • FIR coefficients - FIR coefficients. One row per output. For the SISO mode, the coefficients are specified as a row vector. For the SIMO mode, the coefficients are specified as a matrix where each row corresponds to a separate output.
  • Initial condition - 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.
  • Sample time - Time interval between samples.
  • Parameter data type - Any data type supported by the Fixed-Point Blockset.
  • Parameter scaling - 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.
  • 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 back propagation.
  • Output data type - Any data type supported by the Fixed-Point Blockset.
  • Output scaling - 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 checked, the 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 checked, fixed-point overflows saturate. Otherwise, they wrap.
  • Override data type(s) with doubles - If checked, the output data type is overridden with doubles.
  • Log minimums and maximums - If checked, minimum and maximum simulation values are logged to the workspace.

Parameter Scaling

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:

  • Use Specified Scaling - This mode uses the slope/bias or radix point-only scaling specified for the editable Parameter scaling parameter (for example, \(2^{-10}\)).
  • Best Precision: Element-wise - This mode produces radix points such that the precision is maximized for each element of the FIR coefficients parameter.
  • Best Precision: Row-wise - This mode produces a common radix point for each element of the FIR coefficients row based on the best precision for the largest value of that row.
  • Best Precision: Column-wise - This mode produces a common radix point for each element of the FIR coefficients column based on the best precision for the largest value of that column.
  • Best Precision: Matrix-wise - This mode produces a common radix point for each element of the FIR coefficients matrix based on the best precision for the largest value of the matrix.

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.

Characteristics

Characteristic Description
Input Port Any data type supported by the blockset (must be a scalar)
Output Port Any data type supported by the blockset
Direct Feedthrough Yes
Sample Time Specified as a parameter
Scalar Expansion Of initial conditions
States One less than the column number in the FIR coefficients vector or matrix
Vectorized Yes