|MATLAB Function Reference|
Y = expm(X)
raises the constant to the matrix power
expm function produces complex results if
X has nonpositive eigenvalues.
exp for the element-by-element exponential.
expm is a built-in function that uses the Padé approximation with scaling and squaring. You can see the coding of this algorithm in the
References  and  describe and compare many algorithms for computing a matrix exponential. The built-in method,
This example computes and compares the matrix exponential of
A and the exponential of
Notice that the diagonal elements of the two results are equal. This would be true for any triangular matrix. But the off-diagonal elements, including those below the diagonal, are different.
 Golub, G. H. and C. F. Van Loan, Matrix Computation, p. 384, Johns Hopkins University Press, 1983.
 Moler, C. B. and C. F. Van Loan, "Nineteen Dubious Ways to Compute the Exponential of a Matrix," SIAM Review 20, 1979, pp. 801-836.