|MATLAB Function Reference|
Evaluate general matrix function
F = funm(A,fun)
for a square matrix argument
evaluates the matrix version of the function
fun. For matrix exponentials, logarithms and square roots, use
[F,esterr] = funm(A,fun)
does not print any message, but returns a very rough estimate of the relative error in the computed result.
A is symmetric or Hermitian, then its Schur form is diagonal and
funm is able to produce an accurate result.
L = logm(A) uses
funm to do its computations, but it can get more reliable error estimates by comparing
S = sqrtm(A) and
E = expm(A) use completely different algorithms.
fun can be specified using
is the matrix sine of the 3-by-3 magic matrix.
Example 2. The statements
produce the same results to within roundoff error as
In either case, the results satisfy
S*S+C*C = I, where
funm uses a potentially unstable algorithm. If
A is close to a matrix with multiple eigenvalues and poorly conditioned eigenvectors,
funm may produce inaccurate results. An attempt is made to detect this situation and print a warning message. The error detector is sometimes too sensitive and a message is printed even though the the computed result is accurate.
The matrix functions are evaluated using Parlett's algorithm, which is described in .
 Golub, G. H. and C. F. Van Loan, Matrix Computation, Johns Hopkins University Press, 1983, p. 384.
 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.