MATLAB Functions | Help Desk |
expm
Matrix exponential
Y = expm(X)
Y = expm(X)
raises the constant e to the matrix power X.
Complex results are produced if X
has nonpositive eigenvalues.
Use exp
for the element-by-element exponential.
The expm
function is built-in, 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 uses a Taylor series approximation. This method is demonstrated in the file expm2.m
. The Taylor series approximation 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 eigenvectors.
References [1] and [2] describe and compare many algorithms for computing expm(X)
. The built-in method, expm1
, is essentially method 3 of [2].
Suppose A
is the 3-by-3 matrix
1 1 0 0 0 2 0 0 -1then
expm(A)
is
2.7183 1.7183 1.0862 0 1.0000 1.2642 0 0 0.3679while
exp(A)
is
2.7183 2.7183 1.0000 1.0000 1.0000 7.3891 1.0000 1.0000 0.3679Notice 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.
exp
Exponential
funm
Evaluate functions of a matrix
logm
Matrix logarithm
sqrtm
Matrix square root