abs

Syntax

abs(X)

Arguments

X is a scalar/pair/vector/matrix.

Details

Return the element-by-element absolute value(s) of X.

Examples

abs(-2.0);
// output: 2

abs(-2 -3 4);
// output: [2, 3, 4]