FixPt Gain
Multiply the input by a constant
Description
The FixPt Gain block is a masked S-function that multiplies the input by a constant value (the gain). After multiplication, the results are converted to the output data type using the specified rounding and overflow modes. To multiply the input by a constant matrix, use the FixPt Matrix Gain block.
Dialog Box Parameters

- Gain value - Specify as a vector or scalar. The gain value is converted from doubles to the specified data type offline using round-to-nearest and saturation.
- Parameter data type - Any data type supported by the Fixed-Point Blockset.
- Parameter scaling - Radix point-only or slope/bias scaling. Additionally, if the gain value is specified as a vector, it can be scaled using the constant vector 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 parameter data type and output data type values are overridden with doubles.
- Log minimums and maximums - If checked, minimum and maximum simulation values are logged to the workspace.
Parameter Scaling
You specify the scaling for the gain with the Parameter scaling parameter. Note that there are two dialog box parameters that control the gain 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 these scaling modes:
- Use Specified Scaling - Uses the slope/bias or radix point-only scaling specified for the editable scaling parameter (for example, \(2^{-10}\)).
- Best Precision: Element-wise - Produces radix points such that the precision is maximized for each element of the gain vector.
- Best Precision: Vector-wise - Produces a common radix point for each element of the gain vector based on the best precision for the largest value of the vector.
Characteristics
| Characteristic | Description |
|---|---|
| Input Port | Any data type supported by the blockset |
| Output Port | Any data type supported by the blockset |
| Direct Feedthrough | Yes |
| Sample Time | Specified as a parameter |
| Scalar Expansion | Of inputs and gain |
| States | 0 |
| Vectorized | Yes |