Perform mathematical function
Simulink / Math Operations
HDL Coder / Math Operations
The Math Function block performs numerous common mathematical functions.
To perform square root calculations, use the Sqrt block.
You can select one of these functions from the Function parameter list.
Function  Description  Mathematical Expression  MATLAB^{®} Equivalent 

exp

Exponential 

exp

log

Natural logarithm 

log

10^u

Power of base 10 


log10

Common (base 10) logarithm 

log10

magnitude^2

Complex modulus 
 
square

Power 2 


pow

Power 

power

conj

Complex conjugate 

conj

reciprocal

Reciprocal 


hypot

Square root of sum squares 

hypot

rem

Remainder after division 
— 
rem

mod

Modulus after division 
— 
mod

transpose

Transpose 


hermitian

Complex conjugate transpose 


The block output is the result of the operation of the function on the input or inputs. The functions support these types of operations.
Function  Scalar Operations  ElementWise Vector and Matrix Operations  Vector and Matrix Operations 

exp

Yes 
Yes 
— 
log

Yes 
Yes 
— 
10^u

Yes 
Yes 
— 
log10

Yes 
Yes 
— 
magnitude^2

Yes 
Yes 
— 
square

Yes 
Yes 
— 
pow

Yes 
Yes 
— 
conj

Yes 
Yes 
— 
reciprocal

Yes 
Yes 
— 
hypot

Yes, on two inputs 
Yes, on two inputs (two vectors or two matrices of the same size, a scalar and a vector, or a scalar and a matrix) 
— 
rem

Yes, on two inputs 
Yes, on two inputs (two vectors or two matrices of the same size, a scalar and a vector, or a scalar and a matrix) 
— 
mod

Yes, on two inputs 
Yes, on two inputs (two vectors or two matrices of the same size, a scalar and a vector, or a scalar and a matrix) 
— 
transpose

Yes 
— 
Yes 
hermitian

Yes 
— 
Yes 
The name of the function appears on the block. The appropriate number of input ports appears automatically.
Use the Math Function block when you want vector or matrix output.
This table shows the input data types that each function of the block can support.
Function  single  double  boolean  builtin integer  fixed point 


Yes 
Yes 
— 
— 
— 

Yes 
Yes 
— 
— 
— 

Yes 
Yes 
— 
— 
— 

Yes 
Yes 
— 
— 
— 

Yes 
Yes 
— 
Yes 
Yes 

Yes 
Yes 
— 
Yes 
Yes 

Yes 
Yes 
— 
— 
— 

Yes 
Yes 
— 
Yes 
Yes 

Yes 
Yes 
— 
Yes 
Yes 

Yes 
Yes 
— 
— 
— 

Yes 
Yes 
— 
Yes 
— 

Yes 
Yes 
— 
Yes 
— 

Yes 
Yes 
Yes 
Yes 
Yes 

Yes 
Yes 
— 
Yes 
Yes 
Data Types 

Direct Feedthrough 

Multidimensional Signals 

VariableSize Signals 

ZeroCrossing Detection 
