Returns the sign of a number. |
||
Syntax |
s = Sign(m) |
|
Argument |
Name |
Description |
m |
A real or complex scalar, vector or matrix. |
|
Output |
Name |
Description |
s |
For each non-zero entry, the result is the entry divided by its absolute value, and 0 otherwise. |
|
Example 1 |
Find the signum of elements in a matrix. |
|
Syntax |
||
S = Sign([1,-2,0,4]) |
||
Result |
||
S = 1 -1 0 1 |
||
Example 2 |
Find the signum of a complex value. |
|
Syntax |
||
S = Sign(3 + 4i) |
||
Result |
||
S = 0.6 + 0.8i |
||
See Also: |