# 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.

## 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

Name | Label | Description | Data Type | Valid Values |
---|---|---|---|---|

| Number of inputs | Number | ||

| Workspace Evaluation | |||

| Mathematical expression | String | ||

| Apply zero-crossing | Scalar | 0 | |

| Use custom input names | Number | 0 | |

| Custom input names | The variable names of inputs. | Structure | |

| Variable name | Input variable name. | Cell of strings | |

| External activation | Number | 0 |

## Ports

Name | Type | Description | IO Type | Number |
---|---|---|---|---|

| explicit | output | 1 | |

| explicit | input | nin | |

| activation | input | externalActivation |

## Advanced Properties

Name | Value | Description |
---|---|---|

| no | |

| yes | |

| depends on block parameters | |

| depends on block parameters | |

| no | |

| no |