Math Function
Maths 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 |
---|---|---|---|
|
Exponent |
|
|
|
Natural logarithm |
|
|
|
Degree of base 2 |
|
|
|
Degree of base 10 |
|
|
|
Common (base 10) logarithm |
|
|
|
Complex modulus |
|
|
|
Squaring |
|
|
|
Degree |
(By default) or (applies only to even-order roots) |
|
|
Complex conjugation |
|
|
|
Inverse |
1/ |
|
|
Square root of the sum of squares |
|
|
|
Residue after division |
- |
`rem |
|
Modulus after division |
- |
|
|
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 |
---|---|---|---|
|
Yes |
Yes |
Not applicable |
|
Yes |
Yes |
Not applicable |
|
Yes |
Yes |
Not applicable |
|
Yes |
Yes |
Not applicable |
|
Yes |
Yes |
Not applicable |
|
Yes |
Yes |
Not applicable |
|
Yes |
Yes |
Not applicable |
|
Yes, on two inputs |
Yes, on two inputs (any combination of dimensionality satisfying broadcast capabilities) |
Not applicable |
|
Yes |
Yes |
Not applicable |
|
Yes |
Yes |
Not applicable |
|
Yes, on two inputs |
Yes, on two inputs (any combination of dimensionality satisfying the brodcast capability) |
- |
|
Yes, on two inputs |
Yes, on two inputs (any combinations of dimensionality satisfying the brodcast capabilities) |
Not applicable |
|
Yes, on two inputs |
Yes, on two inputs (any combinations of dimensionality satisfying the broadcast capability) |
Not applicable |
|
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 |
|
Complex numbers support |
Yes |
Input
#
IN_1
—
input signal
scalar
| vector
| matrix
Details
Input signal as a scalar, vector or matrix.
Data types |
|
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 |
|
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 |
|
Default value |
|
Program usage name |
|
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 |
||
|
`complex |
`complex |
`error |
|
|
`complex |
`real |
`real |
|
|
`complex |
|
`error |
|
Values |
|
Default value |
|
Program usage name |
|
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 |
|
Program usage name |
|
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 |
|
Default value |
|
Program usage name |
|
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 |
|
Program usage name |
|
Tunable |
No |
Evaluatable |
Yes |