MATLAB Function Reference | ![]() ![]() |
Syntax
Y = sign(X)
Description
Y = sign(X)
returns an array Y
the same size as X
, where each element of Y
is:
1
if the corresponding element of X
is greater than zero0
if the corresponding element of X
equals zero-1
if the corresponding element of X
is less than zeroFor nonzero complex X
, sign(X)
=
X./abs(X)
.
See Also
abs
Absolute value and complex magnitude
conj
Complex conjugate
imag
Imaginary part of a complex number
real
Real part of complex number
![]() | shrinkfaces | sin, sinh | ![]() |