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);
end
disp(exp_A);
E = V*(exp(D))\V;
disp(E);
3 Comments
Direct link to this comment
https://nl.mathworks.com/matlabcentral/answers/434074-why-am-i-getting-the-error-array-indices-must-be-positive-integers-or-logical-values#comment_646784
Direct link to this comment
https://nl.mathworks.com/matlabcentral/answers/434074-why-am-i-getting-the-error-array-indices-must-be-positive-integers-or-logical-values#comment_646784
Direct link to this comment
https://nl.mathworks.com/matlabcentral/answers/434074-why-am-i-getting-the-error-array-indices-must-be-positive-integers-or-logical-values#comment_801884
Direct link to this comment
https://nl.mathworks.com/matlabcentral/answers/434074-why-am-i-getting-the-error-array-indices-must-be-positive-integers-or-logical-values#comment_801884
Direct link to this comment
https://nl.mathworks.com/matlabcentral/answers/434074-why-am-i-getting-the-error-array-indices-must-be-positive-integers-or-logical-values#comment_863493
Direct link to this comment
https://nl.mathworks.com/matlabcentral/answers/434074-why-am-i-getting-the-error-array-indices-must-be-positive-integers-or-logical-values#comment_863493
Sign in to comment.