Simulink Reference    
Gain, Matrix Gain

Multiply the input by a constant

Library

Simulink Math Operations and Fixed-Point Blockset Math

Description



The Gain block multiplies the input by a constant value (gain). The input and the gain can each be a scalar, vector, or matrix.

You specify the value of the gain in the Gain parameter. The Multiplication parameter lets you specify element-wise or matrix multiplication. For matrix multiplication, this parameter also lets you indicate the order of the multiplicands.

When the Show additional parameters check box is selected, some of the parameters that become visible are common to many blocks. For a detailed description of these parameters, refer to Block Parameters in the Fixed-Point Blockset documentation.

The Matrix gain block is an implementation of the Gain block with different default settings.

Data Type Support

The input and gain of the Gain block can be a real or complex scalar, vector, or matrix of any data type except boolean, int64, and uint64. If the input is real and the gain is complex, the output is complex.

Parameters and Dialog Box

Gain
Specify the value by which to multiply the input. The gain may be a scalar, vector, or matrix.
Multiplication
Specify the multiplication mode:
Show additional parameters
If selected, additional parameters specific to implementation of the block become visible as shown.

Parameter data type mode
Set the data type and scaling of the gain to be the same as that of the input, or to be inherited via an internal rule. Alternatively, choose to specify the data type and scaling of the gain through the Parameter data type, Parameter scaling mode, and Parameter scaling parameters in the dialog.
Parameter data type
Set the gain data type. This parameter is only visible if Specify via dialog is selected for the Parameter data type mode parameter.
Parameter scaling mode
Set the mode to determine the scaling of the gain.
Parameter scaling
Set the gain scaling using either radix point-only or [Slope Bias] scaling. This parameter is only visible if Specify via dialog is selected for the Parameter data type mode parameter, and if Use specified scaling is selected for the Parameter scaling mode parameter.
Output data type mode
Set the data type and scaling of the output to be the same as that of the input, or to be inherited via an internal rule or by backpropagation. Alternatively, choose to specify the data type and scaling of the output through the Output data type and Output scaling value parameters in the dialog.
If you select Inherit via internal rule for this parameter, Simulink chooses a combination of output scaling and data type that requires the smallest amount of memory consistent with accommodating the output range and maintaining the output precision of the block. If the Production hardware characteristics parameter on the Advanced pane of the Simulation Parameters dialog is set to Unconstrained integer sizes, Simulink chooses the output data type without regard to hardware constraints. If the parameter is set to Microprocessor, Simulink chooses the smallest available hardware data type capable of meeting the range and precision constraints. For example, if the block multiplies an input of type int8 by a gain of int16 and Unconstrained integer sizes is specified, the output data type is sfix24. If Microprocessor is specified and the microprocessor supports 8-bit, 16-bit, and 32-bit words, the output data type is int32. If none of the word lengths provided by the target microprocessor can accommodate the output range, Simulink displays an error message in the Simulink Diagnostic Viewer.
Output data type
Set the output data type. This parameter is only visible if Specify via dialog is selected for the Output data type mode parameter.
Output scaling value
Set the output scaling using either radix point-only or [Slope Bias] scaling. This parameter is only visible if Specify via dialog is selected for the Output data type mode parameter.
Lock output scaling against changes by the autoscaling tool
If selected, scaling of outputs is locked. This parameter is only visible if Specify via dialog is selected for the Output data type mode parameter.
Round integer calculations toward
Select the rounding mode for integer output.
Saturate on integer overflow
If selected, overflows saturate.

Conversions and Operations

The gain is converted from doubles to the specified data type offline using round-to-nearest and saturation. Refer to Parameter Conversions in the Fixed-Point Blockset documentation for more information about parameter conversions. The input and gain are then multiplied, and the result is converted to the output data type using the specified rounding and overflow modes. Refer to Rules for Arithmetic Operations in the Fixed-Point Blockset documentation for more information about the rules that this block obeys when performing fixed-point operations.

Characteristics

Dimensionalized
Yes
Direct Feedthrough
Yes
Sample Time
Inherited from driving block
Scalar Expansion
Of input and Gain parameter for Element-wise multiplication
Zero Crossing
No


  Function-Call Subsystem Goto