Section: Elementary Functions
y = abs(x)
where x is an n-dimensional array of numerical type. The output
is the same numerical type as the input, unless the input is complex
or dcomplex. For complex inputs, the absolute value is a floating
point array, so that the return type is float. For dcomplex
inputs, the absolute value is a double precision floating point array, so that
the return type is double.
abs applied to a complex scalar.
--> abs(3+4*i) ans = 5 --> quit
The abs function applied to integer and real values:
--> abs([-2,3,-4,5]) ans = 2 3 4 5 --> quit
For a double-precision complex array,
--> abs([2.0+3.0*i,i])
ans =
3.6056 1.0000
-->
quit