abs
Returns the absolute value of a scalar/matrix/complex number.
Syntax
abs(a, ...)
Inputs
- a
- Any valid scalar | string | vector | matrix
Outputs
- R
- Absolute value of a
Examples
Absolute value of a negative scalar:
abs(-0.5)
ans = 0.5
Absolute value of a complex number:
R = abs(2i + 8)
R = 8.24621125
Absolute value of a matrix:
abs([-3,.6])
ans = [ 3 0.6 ]