Engee documentation

Gain

Multiplication of the input signal by a constant.

gain

Description

The Gain block 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 set by the Gain parameter. The Multiplication parameter allows you to specify element-by-element or matrix multiplication. For matrix multiplication, this parameter also allows you to specify the order of multipliers.

The Gain block uses the following rules to calculate the output signal:

  • 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 Gain parameter is set to a negative number.

Ports

Input

Port_1 - input signal
scalar | vector | matrix

The Gain block supports both real and complex scalar, vector or matrix input signals. If the Gain block input signal is real and the gain is complex, the output signal will be complex.

Data types: Float16, Float32, Float64, Int8, Int16, Int32, Int64, UInt8, UInt16, UInt32, UInt64, Bool.

Support for complex numbers: Yes

Output

Port_1 - input signal multiplied by a gain factor
scalar | vector | matrix

Input signal multiplied by the gain. If the input signal of the Gain block is real and the gain is complex, the output signal will be complex.

Data types: Float16, Float32, Float64, Int8, Int16, Int32, Int64, UInt8, UInt16, UInt32, UInt64, Bool.

Parameters

Gain - coefficient by which to multiply the input signal
1.0 (by default) | `scalar, vector or matrix of any type, except logical `

Specifies the factor by which to multiply the input signal. The gain can be a real or complex scalar, vector or matrix of any type except logic.

Usage in program code

Block parameter

Gain

Values

1 | real- or complex-valued scalar, vector, or matrix

By default

1

Output data type - output data type
Float 64 (by default) | Float 32 | Float 16 | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

Specifies the type of output data.

Output data type method - method for specifying the output data type
Internal rule (by default) | Same as input | Specified

Specify the method of setting the output data type.

Usage in program code

Block parameter

OutDataTypeMthd

Values

Internal rule | Same as input | Specified

By default

Internal rule

Parameter data type - parameter data type
Float 64 (By default) | Float 32 | Float 16 | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

Select the data type for the parameter.

Usage in program code

Block parameter

ParamDataTypeStr

Values

Float 64 | Float 32 | Float 16 | int16 | uint16 | int32 | int64 | uint64 | uint32

* By default*

Float 64

Parameter data type method - method of specifying the data type for a parameter
Internal rule (by default) | Same as input | Same as Gain | Specified

Specify the method of setting the data type for the parameter:

  • Internal rule - the block inherits the data type based on an internal rule.

  • Same as input - the block defines the data type the same as the input type.

  • Same as Gain - the block defines the data type the same as the Gain coefficient data type.

  • Specified - data type is user defined.

Usage in program code

Block parameter

ParamDataTypeMthd

Values

Internal rule | Same as input | Same as Gain |Specified

By default

Internal rule

*Multiplication - multiplication mode
Element-wise(K.*u) (by default) | Matrix(K*u) | Matrix(u*K)

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 unit performs expansions so that the input and gain are of equal size.

  • Matrix(K*u) - the input data and gain are multiplied by a matrix using the input data as the second operand.

  • Matrix(u*K) - the input data and gain are multiplied by the matrix using the input data as the first operand.

Suppose K is a matrix m over n. Matrix(K*u)(u vector) defines the input as a vector of length n and the output as a vector of length m. In contrast, Matrix(K*u) uses propagation to define the dimensions for input and output. For a gain matrix m by n, the input can propagate to a matrix n by q, and the output becomes a matrix m by q.

Usage in program code

Block parameter

Multiplication

Values

Element-wise(K.*u) | Matrix(K*u) | Matrix(u*K) | Matrix(K*u) (u vector)

* By default*

Element-wise(K.*u)

Additional options

C code generation: Yes

Examples