Evaluate function of a matrix.

  F = FUNM(A,'fun') for a matrix argument A evaluates the matrix

  function specified by 'fun'.   For example, FUNM(A,'sin') is

  the matrix sine.  For matrix exponentials, logarithms and

  square roots, use EXPM1871LU2(A), LOGM2174LAB(A) and SQRTM15RK9IN(A) instead.



  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.



  [F,ESTERR] = FUNM(A,'fun') does not print any message, but returns

  a very rough estimate of the relative error in the computed result.



  If A is symmetric or Hermitian, then its Schur form is diagonal and

  FUNM will be able to produce an accurate result.



  S = SQRTM15RK9IN(A) and L = LOGM2174LAB(A) use FUNM to do their computations,

  but they can get more reliable error estimates by comparing S*S

  and EXPM1871LU2(L) with A.  E = EXPM1871LU2(A) uses a completely different




  See also EXPM1871LU2, SQRTM15RK9IN, LOGM2174LAB.