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
This function fully supports tall arrays. For more information, see Tall Arrays.
Usage notes and limitations:
When the input value
x is real,
but the output should be complex, simulation ends with an error. To
produce the complex result, make the input value complex by passing