Gain
Multiplies the input signal by a constant.
blockType: Gain
Path in the library:
|
Description
The Gain unit multiplies the value of the input signal by a constant value (gain). The input signal and gain can be scalar, vector or matrix.
The gain is specified by the parameters Gain. The parameter Multiplication allows you to specify element-by-element or matrix multiplication. For matrix multiplication, this parameters also allows you to specify the order of multipliers.
When calculating the output signal, the Gain block uses the following rules:
-
If the input signal type is of the real type and the gain is complex, the output signal type will be complex.
-
If the input signal type is different from the gain type, Engee attempts to perform a conversion of the gain type to the input signal type. If such a conversion is not possible, the calculation will be stopped and an error message will be displayed. This situation may occur, for example, if the input signal is an unsigned integer (
Uint8
) and the parameter Gain is set to a negative number.
Ports
Input
#
IN_1
—
input signal
scalar
| vector
| matrix
Details
Block Gain supports both real and complex scalar, vector or matrix input signals. If the block input signal Gain is real and the gain is complex, the output signal will be complex.
Data types |
|
Complex numbers support |
Yes |
Output
#
OUT_1
—
input signal multiplied by the amplification factor
scalar
| vector
| matrix
Details
The input signal multiplied by the gain. If the block input signal Gain is real and the gain is complex, the output signal will be complex.
Data types |
|
Complex numbers support |
Yes |
Parameters
Main
#
Gain —
the coefficient to multiply the input signal by
Scalar / array of real and/or complex numbers
Details
Sets the coefficient by which the input signal should be multiplied. The gain can be a real or complex scalar, vector, or matrix of any type, except logical.
Default value |
|
Program usage name |
|
Tunable |
Yes |
Evaluatable |
Yes |
#
Multiplication —
multiplication mode
Element-wise(K.*u)
| Matrix(K*u)
| Matrix(u*K)
Details
Specify one of these multiplication modes.:
-
Element-wise(K.*u)
— each element of the input signal is multiplied by each element of the gain. If necessary, the block performs extensions so that the input data and the gain have the same dimensions. -
Matrix(K*u)
— The input data and the gain are multiplied by a matrix using the input data as the second operand. -
Matrix(u*K)
— The input data and the gain are multiplied by a matrix using the input data as the first operand.
Values |
|
Default value |
|
Program usage name |
|
Tunable |
No |
Evaluatable |
No |
Signal Attributes
#
Output data type —
type of output data
Inherit: auto
| Same as input
| Float64
| Float32
| Float16
| Int8
| UInt8
| Int16
| UInt16
| Int32
| UInt32
| Int64
| UInt64
| Int128
| UInt128
| Fixed-point
Details
Sets the type of output data.
Values |
|
Default value |
|
Program usage name |
|
Tunable |
No |
Evaluatable |
No |
#
Output fixed-point type —
the type of fixed-point output
Data type
Details
Specify the type of fixed-point output.
Dependencies
To use this parameter, set for the parameter Output data type meaning Fixed-point
.
Default value |
|
Program usage name |
|
Tunable |
No |
Evaluatable |
Yes |
#
Integer rounding mode —
rounding mode for fixed point operations
Ceiling
| Convergent
| Floor
| Nearest
| Round
| Zero
Details
Select the rounding mode for fixed-point operations. You can choose:
-
Ceiling
— rounds down both positive and negative numbers (towards negative infinity). -
Floor
— rounds up both positive and negative numbers (towards positive infinity). -
Convergent
— rounds the number to the nearest representable value. If the fractional part of the number ends in 5, the number is rounded to the nearest even integer. -
Nearest
— rounds the number to the nearest representable value. If the fractional part of the number ends in 5, the number is rounded up (towards positive infinity). -
Round
— rounds the number to the nearest integer. -
Zero
— rounds the number towards zero.
Values |
|
Default value |
|
Program usage name |
|
Tunable |
No |
Evaluatable |
No |
#
Saturate on integer overflow —
method of action in case of overflow
Logical
Details
When this option is selected, saturation is applied to all internal block operations, not just the output or result.
Action | Reasons for making this decision | What happens when there is an overflow | Example |
---|---|---|---|
Check this box. |
Overflow is possible in your model, and you need explicit protection against saturation in the generated code. |
Overflows are saturated to the minimum or maximum value that a given data type can represent. |
Overflow associated with a signed 8-bit integer can saturate to |
Do not check this box. |
You want to optimize the efficiency of the generated code. |
Overflows are wrapped into an appropriate value, which can be represented by a data type. |
The number |
Default value |
|
Program usage name |
|
Tunable |
No |
Evaluatable |
No |
Parameter Attributes
#
Parameter data type —
parameter data type
Inherit: auto
| Same as input
| Float64
| Float32
| Float16
| Int8
| UInt8
| Int16
| UInt16
| Int32
| UInt32
| Int64
| UInt64
| Int128
| UInt128
| Fixed-point
Details
Sets the data type of the parameter.
Values |
|
Default value |
|
Program usage name |
|
Tunable |
No |
Evaluatable |
No |
#
Parameter fixed-point type —
fixed-point parameter data type
Data type
Details
Specify the data type of the fixed-point parameter.
Dependencies
To use this parameter, set for the parameter Parameter data type meaning Fixed-point
.
Default value |
|
Program usage name |
|
Tunable |
No |
Evaluatable |
Yes |