I want to compare the exponential of matrix A obtained by the summation formula and the one with the eigen values. However, I'm getting the following error when exponential is computed with the diagonalised form (E here).
"Array indices must be positive integers or logical values."
A = [1,2,1,3; 3,1,2,0; 2,2,1,4; 1,3,2,1];
[V,D] = eig(A);
exp_A = 0;
for k = 0:100
exp_A = exp_A + (A^k)/factorial(k);
E = V*(exp(D))\V;