view mftoolbox/funm_ev.m @ 7:e0817ccb2834 draft

Add square root matrix function file, rename atom at funm_files, modify old toolbox to run it inside GNU Octave. added funm_files/fun_atom.m added sqrtm2.m added toolbox/gecp.m toolbox/see.m: comment wrong call to subplot toolbox/tmtdemo.m: add a cast to double, as eig does not admit bool matrix input removed funm_files/funm_atom.m
author Antonio Pino Robles <data.script93@gmail.com>
date Tue, 26 May 2015 18:14:54 +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;