Simulink Reference Previous page   Next Page
Math Function

Perform a mathematical function

Library

Math Operations

Description


The Math Function block performs numerous common mathematical functions.

You can select one of the following functions from the Function parameter list.

The block output is the result of the operation of the function on the input or inputs.

The name of the function appears on the block. Simulink automatically draws the appropriate number of input ports.

Use the Math Function block instead of the Fcn block when you want vector or matrix output, because the Fcn block produces only scalar output.

Data Type Support

The following table shows which input data types are supported by each of the functions of the Math Function block.

Function
single
double
built-in integer
fixed point
exp
yes
yes
--
--
log
yes
yes
--
--
10^u
yes
yes
--
--
log10
yes
yes
--
--
magnitude^2
yes
yes
yes
yes
square
yes
yes
yes
yes
sqrt
yes
yes
--
--
pow
yes
yes
--
--
conj
yes
yes
yes
yes
reciprocal
yes
yes
yes
yes
hypot
yes
yes
--
--
rem
yes
yes
yes
--
mod
yes
yes
yes
--
transpose
yes
yes
yes
yes
hermitian
yes
yes
yes
yes

All supported modes accept both real and complex inputs, except for reciprocal, which does not accept complex fixed-point inputs. The output signal type of the block is real or complex, depending on the setting of the Output signal type parameter.

Parameters and Dialog Box

The Main pane of the Math Function block dialog appears as follows:

Function
Specify the mathematical function.
Output signal type
Select the output signal type of the Math Function block as real, complex, or auto.


Input
Output Signal Type
Function
Signal
Auto
Real
Complex
Exp, log, 10u, log10, square, sqrt, pow, reciprocal, conjugate, transpose, hermitian
real
complex
real
complex
real
error
complex
complex
magnitude squared
real
complex

real
real

real
real

complex
complex

hypot, rem, mod
real
complex
real
error
real
error
complex
error
Sample time (-1 for inherited)
Specify the time interval between samples. To inherit the sample time, set this parameter to -1. See Specifying Sample Time in the online documentation for more information.

The Signal data types pane of the Math Function block dialog appears as follows:

Output data type mode
Set the data type and scaling of the output to be a built-in data type, the same as that of the first input, or to be inherited via an internal rule or by backpropagation. Alternatively, choose to specify the data type and scaling of the output through the Output data type and Output scaling value parameters.
Output data type
Set the output data type. This parameter is only visible if you select Specify via dialog for the Output data type mode parameter.
Output scaling value
Set the output scaling using either binary point-only or [Slope Bias] scaling. This parameter is only visible if you select Specify via dialog for the Output data type and scaling parameter.
Lock output scaling so autoscaling tool can't change it
If you select this check box, the output scaling is locked.
Round integer calculations toward
Select the rounding mode for fixed-point operations.
Saturate on integer overflow
If selected, fixed-point overflows saturate.

Characteristics

Direct Feedthrough
Yes
Sample Time
Specified in the Sample time parameter
Scalar Expansion
Yes, of the input when the function requires two inputs
Dimensionalized
Yes
Zero Crossing
No


Previous page  Manual Switch MATLAB Fcn Next page

© 1994-2005 The MathWorks, Inc.