# PS Math Function

Apply mathematical function to input physical signal

• Library:
• Simscape / Foundation Library / Physical Signals / Functions

• ## Description

The PS Math Function block applies a mathematical function to the value and unit of the input physical signal, u. The block output is the result of the operation of the function on the input. You can select one of the following functions from the Function choice parameter list.

FunctionDescriptionMathematical Expression
`sin(u)`Sinesin(u)
`cos(u)`Cosinecos(u)
`exp(u)`Exponentialeu
`log(u)`Natural logarithmln(u)
`10^u`Power of base 1010u
`log10(u)`Common (base 10) logarithmlog(u)
`u^2`Power 2u2
`sqrt(u)`Square rootu0.5
`1/u`Reciprocal1/u
`tanh(u)`Hyperbolic tangenttanh(u)

The PS Math Function block issues a simulation-time error when the input falls out of the expected domain for the particular function used. For example, if set to `sqrt(u)`, the PS Math Function block issues an error if it receives negative input during simulation.

Note

For `u^2`, `sqrt(u)`, and `1/u` the unit of the output signal is the result of the operation of the function on the input signal unit. For all other functions in the list, the input signal must be unitless.

## Ports

### Input

expand all

Input port for the operand physical signal, u.

The port name is not visible in the block icon, but you can see this name in the underlying source file (accessible by clicking the Source code link in the block dialog box).

### Output

expand all

Output physical signal.

The port name is not visible in the block icon, but you can see this name in the underlying source file (accessible by clicking the Source code link in the block dialog box).

## Parameters

expand all

Select the function to perform. The block output is the result of the operation of the function on the value and unit of the input signal.

## Compatibility Considerations

expand all

Behavior changed in R2019a