Abs
R2026bOutput absolute value of input
Libraries:
Simulink /
Math Operations
HDL Coder /
HDL Floating Point Operations
HDL Coder /
Math Operations
Description
The Abs block outputs the absolute value of the input.
For signed-integer data types, the absolute value of the most negative value is not representable by the data type. In this case, the Saturate on integer overflow check box controls the behavior of the block.
| If you... | The block... | And... |
|---|---|---|
| Select this check box | Saturates to the most positive value of the integer data type |
|
| Do not select this check box | Wraps to the most negative value of the integer data type |
|
The Abs block supports zero-crossing detection. However, when you select Enable zero-crossing detection on the dialog box, the block does not report the simulation minimum or maximum in the Fixed-Point Tool. If you want to use the Fixed-Point Tool to analyze a model, disable zero-crossing detection for all Abs blocks in the model first.
Examples
Ports
Input
Output
Parameters
Block Characteristics
Data Types |
|
Direct Feedthrough |
|
Multidimensional Signals |
|
Variable-Size Signals |
|
Zero-Crossing Detection |
|
Programmatic Use: Add Block
To add the block programmatically, use the add_block function with one of these library block paths as the source.
"simulink/Math Operations/Abs"
"hdlsllib/HDL Floating Point Operations/Abs"
"hdlsllib/Math Operations/Abs"
Example: add_block("simulink/Math Operations/Abs","myModel/myBlock",MakeNameUnique="on")
For information about programmatic access to individual block parameters, see the Programmatic Use section of parameter descriptions on this page.

