Y = expm(X)
expm(X) is the matrix exponential of X. Complex results are produced if X has nonpositive eigenvalues. Use exp for the element-by-element exponential.
expm is a built-in function, but it uses the Padé approximation with scaling and squaring algorithm expressed in the file expm1.m.
A second method of calculating the matrix exponential is via a Taylor series approximation. This method can be found in the file expm2.m. This method is not recommended as a general purpose method. It is often slow and inaccurate.
A third way of calculating the matrix exponential, found in the file expm3.m, is to diagonalize the matrix, apply the function to the individual eigenvalues, and then transform back. This method fails if the input matrix does not have a full set of linearly independent eigenvalues.
References [1] and [2] describe and compare many algorithms for computing expm(X). The built-in method, expm1, is essentially method 3 of [2].
A is the 3-by-3 matrix
then1 1 00 0 20 0 -1
X = expm(A) is
while2.7183 1.7183 1.08620 1.0000 1.26420 0 0.3679
exp(A) is
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.2.7183 2.7183 1.00001.0000 1.0000 7.38911.0000 1.0000 0.3679
exp,funm,logm,sqrtm
[2] C. B. Moler and C. F. Van Loan, "Nineteen Dubious Ways to Compute the Exponential of a Matrix," SIAM Review 20, pp. 801-836, 1979.
(c) Copyright 1994 by The MathWorks, Inc.