Math Function - Perform 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.

FunctionDescriptionMathematical ExpressionMATLAB Equivalent
exp

Exponential

eu

exp
log

Natural logarithm

ln u

log
10^u

Array power of base 10

10u

10.^u
(see power)

log10

Common (base 10) logarithm

log u

log10
magnitude^2

Complex modulus

|u|2

(abs(u)).^2
(see abs and power)

square

Array power 2

u2

u.^2
(see power)

sqrt

Square root

u0.5

sqrt
pow

Array power

uv

power
conj

Complex conjugate

ū

conj
reciprocal

Array reciprocal

1/u

1./u
(see rdivide)

hypot

Square root of sum squares

(u2+v2)0.5

hypot
rem

Remainder after division

rem
mod

Modulus after division

mod
transpose

Array transpose

uT

u.'
(see arithmetic operators)

hermitian

Complex conjugate transpose

uH

u'
(see arithmetic operators)

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

Functionsingledoublebuilt-in integerfixed 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

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 and sqrt, which do not accept complex fixed-point inputs. Also, sqrt does not accept fixed-point inputs that are negative or that have nontrivial slope and nonzero bias. 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. See Description for more information about the options for this parameter.

Output signal type

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

 InputOutput Signal Type
FunctionSignalAutoRealComplex

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 Attributes pane of the Math Function block dialog appears as follows:

Output minimum

Specify the minimum value that the block should output. The default value, [], is equivalent to -Inf. Simulink software uses this value to perform:

Output maximum

Specify the maximum value that the block should output. The default value, [], is equivalent to Inf. Simulink software uses this value to perform:

Output data type

Specify the output data type. You can set it to:

Click the Show data type assistant button to display the Data Type Assistant, which helps you set the Output data type parameter.

See Specifying Block Output Data Types for more information.

Lock output scaling against changes by the autoscaling tool

Select to lock scaling of outputs. This parameter is visible only if you enter an expression for the Output data type parameter.

Round integer calculations toward

Select the rounding mode for fixed-point operations. For more information, see Rounding in the Simulink Fixed Point User's Guide.

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

Multidimensionalized

Yes, for all functions except hermitian and transpose

Zero Crossing

No

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS