Info
Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.
help with using matrix index from previous iteration.
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
hello guys, I hope you have a nice weekend. please, if anyone can help me with this problem related to the matrix index. Bellow is a part of my code.
d{11}=Q_{1:1}*(t(1))^3;
D{11}=(2/3)*d{11};
for ii=2:j
k=ii;ss=ii-1;
d{ii}=d{ss}+Q_{ii}*(((z(k))^3)-((z(k-1))^3));
D{ii}=(2/3)*d{ii};
end
i am trying to use the previous matrix d{ss} to calculate the new one d{ii}. i need all ds to use them in another iteration. the problem is i have this error.
error using +
Matrix dimensions must agree.
Error in Untitled (line 46)
d{ii}=d{ss}+Q_{ii}*(((z(k))^3)-((z(k-1))^3));
also i tried to use d{ii-1} and d{i-1i-1} but i always have the error message. please if there anyway how to insert the previous matrix in my iteration.
2 Kommentare
Jonathan Epperl
am 14 Okt. 2012
How about you look at the matrices in question, for instance using a break point? In particular, what is the dimension of d{10}? My assumption is it is an empty array, and that will get you that error.
[]+magic(2)
%Error using +
%Matrix dimensions must agree.
Antworten (0)
Diese Frage ist geschlossen.
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!