Y = log(X)
log function's domain includes
negative and complex numbers, which can lead to unexpected results
if used unintentionally. For negative and complex numbers
= u + i*w, the complex logarithm
log(abs(z)) + 1i*angle(z)
If you want negative and complex numbers to return error messages
rather than return complex results, use
Show that the natural logarithm of -1 is .
ans = 0.0000 + 3.1416i
X— Input array
Input array, specified as a scalar, vector, matrix, or multidimensional array.
Complex Number Support: Yes
Y— Logarithm values
Logarithm values, returned as a scalar, vector, matrix, or multidimensional array.
For positive real values of
X in the interval
in the interval (
For complex and negative real values of
complex. The data type of
Y is the same as that