abs

Navigation:  Language Reference > Functions > Arithmetic >

abs

Previous pageReturn to chapter overviewNext page

Syntax

Y = abs(X);

Description

Returns the absolute value of X or the elements of X.

Examples

X

abs(X)

1

1

2.1

2.1

-2.6

2.6

-1e-102

1e-102

[1.1,2.7;-3.6,-4]

[1.1,2.7;3.6,4]

Limitations

X and Y must have the same size.
For scalars, the abs function can also be written as: Y = |X|;