The natural logarithm function in MATLAB is log(). To calculate the natural logarithm of a scalar, vector or array, A, enter log(A). Log(A) calculates the natural logarithm of each element of A when A is a vector or array.
The natural logarithm has base e, which is approximately 2.718. Applying the log() function to a number, A, solves the equation e^x = A and returns the number x. The log() function returns real numbers for arguments that include real numbers greater than or equal to zero. Log() returns complex numbers for arguments that include complex numbers or real numbers less than zero.