# MathOperations

## Sum

If the block has more than one input, it performs element-wise addition or subtraction its inputs. All inputs must have the same size or be 1x1. If the block has one input, the output is 1x1 and is obtained by adding (subtracting) all the entries of the input. Addition (+) and subtractions (-) characters indicate the operation to be performed on the inputs.

## Product

If the block has more than one input, it performs element by element multiplication or division of its inputs. All inputs must have the same size and type as the output, but some inputs may also be 1x1. If the block has one input, the output is 1x1 and is obtained by multiplying (dividing) all the elements of the input vector/matrix. Multiply(*) and divide (/) characters indicate the operations to be performed on the inputs. See also the Matrix Multiplication block.

## Gain

This block implements a gain operation where the output is obtained by multiplying the gain parameter by the input. If the gain parameter is scalar, it is multiplied with every entry of the input to produce the output. If it is a matrix, an element-wise product is performed.

## Bias

The Bias block adds a constant to the input to produce the output.

## TrigFunc

This block performs a trigonometric function chosen in a list of available functions. The function is applied to each entry of the input.

## Atan2

This block computes the atan2 (u1,u2) function applied to each entry of input matrices u1 and u2.

## MathFunc

This block applies a function to each entry of its input matrix to produce the corresponding entry of the output matrix. The function can be selected in a set of available functions by the choice of a block parameter.

## Negate

This block implements the unary minus operation.

## Pow

This block implements the pow(u1,u2) function applied to each entry of input matrices to produce the corresponding output. The pow(u1,u2) function calculates u1 to the power u2. Mixed matrix/scalar input is allowed.

## Power

This block implements the to-the-power-of operation. The parameter of the block gives to the parameter, a, the-power-of a, which is applied to every entry of the input to produce the corresponding output.

## Abs

This block implements the absolute value function.

## Sign

This block implements the sign function applied to each entry of the input to produce the corresponding output. The possible output values are 1, 0 and -1.

## Saturation

This block bounds upper and lower values of a signal. When the input signal is within the range specified by the Lower limit and Upper limit parameters, the input signal passes through unchanged. When the input signal is outside these bounds, the signal is set to the upper or lower bound. When the Lower limit and Upper limit parameters are set to the same value, the block outputs that value.

## Quantization

This block implements a quantizer. The output is obtained from the input according to a choice of methods: round, truncation, floor or ceil. When fed with a smooth signal, the block produces a stair-step signal.

## Exponential

This block implements the power function given the base as block parameter: y=a^u where a is the block parameter and u is the input. If a equals exp(1), then the operation corresponds to the exponential function.

## Hypot

This block implements the hypot(u1,u2) function applied to each entry of input matrices to produce the corresponding output. Hypot calculates the length of the hypotenuse of a right-angle triangle. Mixed matrix/scalar input is allowed.

## Log

It realizes : y(i)=log(u(i))/log(a).

## Modulo

This block implements the remainder after the division function. The block provides two options: Modulo and Remainder. Modulo(u1,u2) returns u1-floor(u1/u2)*u2 and Remainder(u1,u2) returns u1-int(u1/u2)*u2

## MaxMin

This block implements the minimum and the maximum functions. If the block has one input, the output is the min or the max of the entries of the input. If the block has more than one input, the output is obtained by applying the min or max function elementwise to the entries of the inputs.

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

## MathExpressions

The output of this block is a vector 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 entry of the unique input vector used by all of the expressions.

## OmlExpression

The output of this block is obtained by evaluating the OML expression specified as a block parameter. The expression is evaluated at run time by the OML interpreter. The variable names u1,...un designate the block inputs in this expression (ui designates the ith input value; u may be used in place of u1). The expression may contain parameters defined in the contexts of the diagram, and functions and parameters defined in the OML environment when the model is simulated. Note that functions and parameters named u, u1, u2,..., will be shadowed by the input variables.

## Horner

This block evaluates a polynomial using the Horner method. Polynomial coefficients may be constant and given as block parameters or variable given by the second input.

## RoundProduct

The output of this block is the element-wise product of the inputs.

## Constraint

This block outputs values so that its input remains zero. This works only if there is a path back from its output to its input in the diagram. If F is the function corresponding to this path, the block solves the equation F(x)=0 where x denotes the output of the block. If the solver cannot find an initial solution, you can provide an initial guess value for the output. If F(x)=0 has several solutions, the initial guess helps the solver to select the desired solution. It is also possible to make use of the output derivative to build the F function, such as F(xapos;,x)=0. In this case, the guess values for x and its derivative xapos; should be provided.