view mftoolbox/funm_ev.m @ 8:a587712dcf5f draft default tip

funm_atom.m: rename fun_atom to funm_atom * funm_atom.m: rename fun_atom to funm_atom.
author Antonio Pino Robles <data.script93@gmail.com>
date Fri, 29 May 2015 09:48:36 +0200
parents 8f23314345f4
children
line wrap: on
line source

function F = funm_ev(A,fun)
%FUNM_EV   Evaluate general matrix function via eigensystem.
%   F = FUNM_EV(A,FUN) evaluates the function FUN at the
%   square matrix A using the eigensystem of A.
%   This function is intended for diagonalizable matrices only
%   and can be numerically unstable.

[V,D] = eig(A);
F = V * diag(feval(fun,diag(D))) / V;