Engee documentation

Fcn

Applying the specified expression to the input.

fcn

Description

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

  • u is the input of the block. If u is a vector, u[i] represents the i-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.

The following operator precedence rules are observed in the Fcn block:

  1. ( )

  2. ^

  3. &plus; - (unary)

  4. !

  5. * /

  6. &plus;-`

  7. > < >= <=

  8. == !=

  9. &&

  10. ||

The input of a block can be a scalar or a vector; the output is always a scalar. If the block input is a vector and the function operates on the input elements separately (e.g., the sin function), the block operates only on the first element of the vector. To get a vector at the output, use the block Math Function.

Ports

Input

In - input signal
scalar | vector

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.

Output

Out - output signal
scalar

Output signal calculated by the block. Only scalar.

Data types: Float64.

Parameters

Expression - mathematical expression
mathematical expression

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

Usage in program code

Block parameter

Expr

Values

mathematical expression

By default

`sin(u(1)exp(2.3(-u(2)))) `