Engee documentation

Math Function

Maths function.

math function

Description

The Math Function block performs a number of common mathematical functions on the input signal(s).

The specific function is specified by the Function parameter.

Function Description Mathematical expression Equivalent in Julia

exp

Exponent

exp

log

Natural logarithm

log

2^u

Degree of base 2

2.^u

10^u

Degree of base 10

10.^u

log10.

Common (base 10) logarithm

log10

magnitude^2

Complex modulus

real(x)^2+imag(x).2

square.

Squaring

u.^2

pow

Degree

(By default) or (applies only to even-order roots)

power

conj

Complex conjugation

ū

conj

reciprocal

reciprocal with Newton-Raphson method.

Inverse

1/

1./u

hypot

Square root of the sum of squares

hypot

rem

Residue after division

-

`rem

mod

Modulus after division

-

mod

transpose

Transpose

transpose

`hermitian

Conjugate transposition

`hermitian

To calculate the square root, use the block Reciprocal Square Root.

The output of the block is the result of calculating the value of the function over the input(s). Functions support the following types of operations:

Function Scalar operations Elemental vector and matrix operations Vector and matrix operations

exp

Yes

Yes

Not applicable

log

Yes

Yes

Not applicable

2^u

Yes

Yes

Not applicable

10^u

Yes

Yes

Not applicable

log10

Yes

Yes

Not applicable

magnitude^2

Yes

Yes

Not applicable

quare

Yes

Yes

Not applicable

pow

Yes, on two inputs

Yes, on two inputs (any combination of dimensionality satisfying broadcast capabilities)

Not applicable

conj

Yes

Yes

Not applicable

reciprocal

reciprocal with Newton-Raphson method.

Yes

Yes

Not applicable

hypot

Yes, on two inputs

Yes, on two inputs (any combination of dimensionality satisfying the brodcast capability)

-

rem

Yes, on two inputs

Yes, on two inputs (any combinations of dimensionality satisfying the brodcast capabilities)

Not applicable

mod

Yes, on two inputs

Yes, on two inputs (any combinations of dimensionality satisfying the broadcast capability)

Not applicable

transpose

Yes

-

Yes

`hermitian

Yes

-

Yes

The function name and the corresponding number of input ports are displayed on the unit.

Use the Math Function block when you need vector or matrix output.

Newton-Raphson Algorithm

For the reciprocal function, you have the option to select the Newton-Raphson algorithm, which will calculate the inverse using the Newton-Raphson approximation method. The function uses recursive approximation to find the best approximations of the roots of the real-valued function.

The inverse of a real number is defined as the zero of the function:

.

The initial approximation is chosen in the range , since this is the convergence region of the function.

To calculate the roots of the function sequentially, set the value of the Number of iterations parameter. The process is repeated as follows:

,

where is the derivative of the function .

Ports

Output

# OUT_1 — function result
scalar | vector | matrix

Details

Output signal as a scalar, vector or matrix. The size of the output signal depends on the value of the Function parameter and the size of the input signals.

Data types

Float16 | Float32 | Float64 | Int8 | Int16 | Int32 | Int64 | UInt8 | UInt16 | UInt32 | UInt64 | Bool

Complex numbers support

Yes

Input

# IN_1 — input signal
scalar | vector | matrix

Details

Input signal as a scalar, vector or matrix.

Data types

Float16, Float32, Float64, Int8, Int16, Int32, Int64, UInt8, UInt16, UInt32, UInt64, Bool

Complex numbers support

Yes

# IN_2 — input signal
scalar | vector | matrix

Details

Input signal as a scalar, vector or matrix.

Dependencies

To use this port, set the Function parameter to pow, hypot, rem or mod.

Data types

Float16, Float32, Float64, Int8, Int16, Int32, Int64, UInt8, UInt16, UInt32, UInt64, Bool

Complex numbers support

Yes

Parameters

Main

# Function — mathematical function
exp | log | 2^u | 10^u | log10 | magnitude^2 | square | pow | conj | reciprocal | hypot | rem | mod | transpose | hermitian

Details

The maths function to be calculated. For more information about this parameter, see section [Описание].

If the Function parameter is set to pow, the Signed power parameter is also used.

Values

exp | log | 2^u | 10^u | log10 | magnitude^2 | square | pow | conj | reciprocal | hypot | rem | mod | transpose | hermitian

Default value

exp

Program usage name

Operator

Tunable

No

Evaluatable

No

# Output signal type — output signal type
auto | real | complex

Details

Specify the output signal type in the Math Function block as auto, real or complex.

Function

Input signal type

Output signal type

Auto

Real

Complex

exp, log, 2^u, 10^u, log10, quare, pow, reciprocal, conjugate, transpose, hermitian

real

`complex

real

`complex

real

`error

complex

complex

magnitude squared

real

`complex

real

`real

real

`real

complex

complex

hypot, rem, mod

real

`complex

real

error

real

`error

complex

error

Values

auto | real | complex

Default value

auto

Program usage name

OutputSignalType

Tunable

No

Evaluatable

No

# Signed power — degree sign
Logical

Details

When calculating the degree, consider the sign of the input signal. This parameter applies only to even-order roots such as , and so on.

  • included - calculation of the degree of the absolute value of the input value multiplied by the sign of the input value.

  • off - calculation of the degree of the actual value of the input value. If the first input value is negative and the second input value is an even-order root, NaN will be returned.

Dependencies

To use this parameter, set the Function parameter to pow.

Default value

false (switched off)

Program usage name

SignedPower

Tunable

No

Evaluatable

No

# Algorithm method — algorithm method for function reciprocal
Exact | Newton-Raphson

Details

The algorithm method for the reciprocal function, given as Exact or Newton-Raphson.

Dependencies

To use this parameter, set the Function parameter to reciprocal.

Values

Exact | Newton-Raphson

Default value

Exact

Program usage name

AlgorithmMethod

Tunable

No

Evaluatable

No

# Number of iterations — number of iterations for the Newton-Raphson algorithm
Int64 integer

Details

The number of iterations for the Newton-Raphson algorithm, given as a scalar.

Dependencies

To use this parameter, set the Function parameter to reciprocal and the Algorithm method parameter to Newton-Raphson.

Default value

3

Program usage name

Iterations

Tunable

No

Evaluatable

Yes

Additional options

C code generation: Yes