How can I store and sum matrix using loop for?
Show older comments
Hi threre.
I have the following matrices and the code I am running to get the sum of matrices:
A = sparse matrix (20000x20000)
I = matrix identity of A
for ii = 1:200
C{ii} = A^ii;
L = I + C{ii};
end
What I would like to get as result is L = I+C{1}+C{2}+C{3}...+C{200}.
However I am getting L = I+C{200}.
Could you help me to find the mistake, please?
Accepted Answer
More Answers (0)
Categories
Find more on Creating and Concatenating Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!