funm
Evaluates a general function of a square matrix.
Category: Mathematics > Linear Algebra
Syntax
F = funm(A, fun)
Returns fun applied to A as a matrix function, where fun is a function handle such as @exp.
Description
A function of a matrix is not the function applied to each entry. It is defined through the eigenstructure of A: for a diagonalizable A = V*D/V, f(A) = V*f(D)/V. funm computes it with the Schur form and works even when A is not diagonalizable.
For @exp it agrees with expm, and for @log with logm, but funm is less accurate than those dedicated functions.
Input arguments
A- Square matrix.
fun- Handle of a scalar function that also works elementwise, for example
@exp,@sinor@sqrt.
Output arguments
F- Matrix of the same size as
A.
Example
Matrix exponential through funm
A = [1 2; 0 3];
F = funm(A, @exp)
disp(norm(F - expm(A)) < 1e-10)
Output
F = 2×2
2.7183 17.3673
0 20.0855
1