MathExpression

The output of this block is a scalar obtained by evaluating the mathematical expressions specified as block parameters. The expressions are given in terms of variables u1,...un (except if using custom input names) where ui is the ith scalar entry of the unique vector input or the ith scalar input in case the block has more than one input.

    MathExpression

Library

MathOperations

Description

The output of this block is a scalar obtained by evaluating the mathematical expressions specified as block parameters. The expressions are given in terms of variables u1,...un where ui is the ith scalar entry of the unique vector input or the ith scalar input in case the block has more than one input.

The expression may also include constant variables as long as they are defined in the diagram workspace. Only scalar operations are allowed between variables and input ui's. Variables however may be OML vectors or matrices; for example if A is an available matrix variable, the operation A(1,1)*u1 is allowed as expression.

Only double data type is allowed. Supported syntax is listed as following

Arithmetical operator: +, -, *, /, ^

Logical operator: |, &, !, ~

Relational operator: >, <, >=, <=, ==, ~=, <>

Elementary functions: abs, exp ,log, log10, min, max, sign, sqrt, hypot

Trigonometric functions: acos, acosh, asin, asinh, atan, atan2, atanh, cos, cosh, sin, sinh, tan

Rounding functions: ceil, floor, int (deprecated), fix, round

Parameters

MathExpression_0

NameLabelDescriptionData TypeValid Values

nin

Number of inputs

Number

work

Workspace Evaluation

exx

Mathematical expression

String

zc

Apply zero-crossing

Scalar

0
1

useinputnames

Use custom input names

Number

0
1

inputnames

Custom input names

The variable names of inputs.

Structure

inputnames/inputname

Variable name

Input variable name.

Cell of strings

externalActivation

External activation

Number

0
1

Ports

NameTypeDescriptionIO TypeNumber

Port 1

explicit

output

1

Port 2

explicit

input

nin

Port 3

activation

input

externalActivation

Advanced Properties

NameValueDescription

always active

no

direct-feedthrough

yes

zero-crossing

depends on block parameters

mode

depends on block parameters

continuous-time state

no

discrete-time state

no