| MATLAB Function Reference | Search  Help Desk |
| funm | Examples See Also |
Evaluate functions of a matrix
Y = funm(X,'function') [Y,esterr] = funm(X,'function')
Y = funm(X,'function')
evaluates function using Parlett's method [1]. X must be a square matrix, and function any element-wise function.
The commands funm(X,'sqrt') and funm(X,'log') are equivalent to the commands sqrtm(X) and logm(X). The commands funm(X,'exp') and expm(X) compute the same function, but by different algorithms. expm(X) is preferred.
[Y,esterr] = funm(X,'function')
does not print any message, but returns a very rough estimate of the relative error in the computer result. If X is symmetric or Hermitian, then its Schur form is diagonal, and funm is able to produce an accurate result.
The statements
S = funm(Xproduce the same results to within roundoff error as,'sin'); C = funm(X,'cos');
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)).
The matrix functions are evaluated using Parlett's algorithm, which is described in [1]. The algorithm uses the Schur factorization of the matrix and may give poor results or break down completely when the matrix has repeated eigenvalues. A warning message is printed when the results may be inaccurate.
expm Matrix exponential
logm Matrix logarithm
sqrtm Matrix square root