Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

help with using matrix index from previous iteration.

1 visualización (últimos 30 días)
Abdulaziz
Abdulaziz el 13 de Oct. de 2012
Cerrada: MATLAB Answer Bot el 20 de Ag. de 2021
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 comentarios
Jonathan Epperl
Jonathan Epperl el 14 de Oct. de 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.

Respuestas (0)

La pregunta está cerrada.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by