Functions > Utility Functions > Sign of Number Functions
Sign of Number Functions
Use these functions to get the sign of a complex-valued expression or number.
sign(x)—This function returns the sign of a real number. It returns the following results:
Argument
Result
x = 0
0
x > 0
1
Otherwise
−1
For a complex number argument, use csgn(z).
signum(z, [x])—This vectorized function returns the sign of a real or complex number. It returns the following results:
Argument
Result
z = 0
x
1 if x is omitted.
z ≠ 0
z/|z|
z and x can be any combination of scalar and vector.
If z and x are both vectors, then they must have the same dimension.
csgn(z)—This function is used to determine in which half-plane (left or right) the complex-valued expression or number zlies. It returns the following results:
Argument
Result
z = 0
0
Re(z) > 0 or (Re(z) = 0 and Im(z) > 0)
1
Otherwise
−1
Arguments
x is a real scalar or vector.
z is a real or complex scalar or vector.
Was this helpful?