Compute and compare the exponential of
A with the matrix exponential of
A = [1 1 0; 0 0 2; 0 0 -1]; exp(A)
ans = 3×3 2.7183 2.7183 1.0000 1.0000 1.0000 7.3891 1.0000 1.0000 0.3679
ans = 3×3 2.7183 1.7183 1.0862 0 1.0000 1.2642 0 0 0.3679
Notice that the diagonal elements of the two results are equal, which is true for any triangular matrix. The off-diagonal elements, including those below the diagonal, are different.
X — Input matrix
Input matrix, specified as a square matrix.
Complex Number Support: Yes
the use of Padé approximation, Taylor series approximation, and
eigenvalues and eigenvectors, respectively, to compute the matrix
exponential. References  and  describe and compare many algorithms for
computing a matrix exponential.
 Higham, N. J., “The Scaling and Squaring Method for the Matrix Exponential Revisited,” SIAM J. Matrix Anal. Appl., 26(4) (2005), pp. 1179–1193.
 Al-Mohy, A. H. and N. J. Higham, “A new scaling and squaring algorithm for the matrix exponential,” SIAM J. Matrix Anal. Appl., 31(3) (2009), pp. 970–989.
 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, 1978, pp. 801–836. Reprinted and updated as “Nineteen Dubious Ways to Compute the Exponential of a Matrix, Twenty-Five Years Later,” SIAM Review 45, 2003, pp. 3–49.
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Usage notes and limitations:
Code generation does not support sparse matrix inputs for this function.
Run code in the background using MATLAB®
backgroundPool or accelerate code with Parallel Computing Toolbox™
This function fully supports thread-based environments. For more information, see Run MATLAB Functions in Thread-Based Environment.
Accelerate code by running on a graphics processing unit (GPU) using Parallel Computing Toolbox™.
This function fully supports GPU arrays. For more information, see Run MATLAB Functions on a GPU (Parallel Computing Toolbox).
Version HistoryIntroduced before R2006a
R2023b: Improved algorithm for single-precision matrices
expm function has an improved algorithm for input matrices
that are single precision. The new algorithm can use fewer terms in the Padé
approximation of some matrix exponentials.