Math Function
A mathematical function.
blockType: Math
Path in the library:
|
Description
Block Math Function performs a number of common mathematical functions on the input signal(s).
The specific function is set by the Function parameter.
Function | Description | Mathematical expression | The equivalent in Julia |
---|---|---|---|
|
The exhibitor |
|
|
|
The natural logarithm |
|
|
|
Base degree 2 |
|
|
|
Base degree 10 |
|
|
|
Common (base 10) logarithm |
|
|
|
Comprehensive module |
|
|
|
Squaring |
|
|
|
Degree |
(by default) or (applies only to roots of even order) |
|
|
Complex coupling |
|
|
|
The inverse value |
1/ |
|
|
The square root of the sum of squares |
|
|
|
The remainder after division |
— |
|
|
The module after division |
— |
|
|
Transposition |
|
|
|
Conjugate transposition |
|
|
To calculate the square root, use the block Sqrt. |
The output of the block is the result of calculating the value of the function over the input(s). The functions support the following types of operations:
Function | Scalar operations | Element-wise 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, at two entrances |
Yes, on two inputs (any combination of dimensions satisfying the capabilities of the broadcaster) |
Not applicable |
|
Yes |
Yes |
Not applicable |
|
Yes |
Yes |
Not applicable |
|
Yes, at two entrances |
Yes, on two inputs (any combination of dimensions satisfying the capabilities of the broadcaster) |
— |
|
Yes, at two entrances |
Yes, on two inputs (any combination of dimensions satisfying the capabilities of the broadcaster) |
Not applicable |
|
Yes, at two entrances |
Yes, on two inputs (any combination of dimensions satisfying the capabilities of the broadcaster) |
Not applicable |
|
Yes |
— |
Yes |
|
Yes |
— |
Yes |
The name of the function and the corresponding number of input ports are displayed on the block.
Use the block Math Function when you need a vector or matrix output signal. |
The Newton–Raphson algorithm
For the reciprocal function, it is possible 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-value function.
The inverse of a real number
The initial approximation is selected in the range
To calculate the roots of a function sequentially, set the value of the Number of iterations parameter. The process is repeated as follows:
where
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 Description.
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
-
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 |