funm

Purpose

Evaluate functions of a matrix.

Synopsis

Y = funm(X,'function')

Description

funm evaluates general matrix functions. For any square matrix argument X, funm(X,'function') evaluates the matrix function specified by function using Parlett's method [1].

funm(X,'sqrt') and funm(X,'log') are equivalent to sqrtm(X) and logm(X). funm(X,'exp') and expm(X) compute the same function, but by different algorithms. expm(X) is preferred.

Examples

The statements

S = funm(X,'sin');
C = funm(X,'cos');
produce the same results to within roundoff error as

E = expm(i*X);
C = real(E);
S = imag(E);
In either case, the results satisfy

S*S+C*C = I
where I = eye(size(X))

Algorithm

The matrix functions are evaluated using Partlett's algorithm, which is described in [1]. The algorithm uses the Schur factorization of the matrix and can give poor results or break down completely when the matrix has repeated eigenvalues. A warning message is printed when the results may be inaccurate.

See Also

expm, logm, sqrtm

References

[1] G. H. Golub and C. F. Van Loan, Matrix Computation, p. 384, Johns Hopkins University Press, 1983.

[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.