Engee documentation

Fcn

Applying the specified expression to the Input.

blockType: Fcn

Path in the library:

/Basic/User-Defined Functions/Fcn

Description

Block Fcn applies the specified mathematical expression to its Input. The expression may include one or more of these components:

  • — block Input. If — vector, then represents -th element of the vector.

  • Numeric constants.

  • Arithmetic operators (+ * / ^).

  • Comparison operators (== != > < >= ) — the expression returns 1 if the relation is true, otherwise it returns 0.

  • Logical operators (&& || !) — the expression returns 1 if the relation is true, otherwise it returns 0.

  • Parentheses.

  • Mathematical functions: abs, acos, asin, atan, ceil, cos, cosh, exp, floor, hypot, log, log10, power, rem, sign, sin, sinh, sqrt, tan and tanh.

In the block Fcn the following rules of operator seniority are observed:

  1. ( )

  2. ^

  3. + (unary)

  4. !

  5. * /

  6. +

  7. > < >=

  8. == !=

  9. &&

  10. ||

The Input of a block can be a scalar or a vector. The output always returns a scalar. If the Input of the block is a vector, and the function operates with the input elements separately (for example, the function sin), then the block operates only on the first element of the vector. To get the vector at the output, use the block Math Function.

Ports

Input

# IN_1 — Input signal
scalar | vector

Details

An input signal to apply the expression specified in the block parameters.

Data types

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

Complex numbers support

Yes

Output

# OUT_1 — Output signal
scalar

Details

The output signal calculated by the block. Only a scalar.

Data types

Float64

Complex numbers support

Yes

Parameters

Main

# Expression — mathematical expression
String

Details

Specify a mathematical expression to apply to the input data. The components of the expression are listed in the block description. The expression must be mathematically correctly formed (use consistent parentheses, the correct number of function arguments, and so on).

Default value

sin(u[1]*exp(2.3*(-u[2])))

Program usage name

Expression

Tunable

No

Evaluatable

Yes