フィルターのクリア

Info

この質問は閉じられています。 編集または回答するには再度開いてください。

help with using matrix index from previous iteration.

1 回表示 (過去 30 日間)
Abdulaziz
Abdulaziz 2012 年 10 月 13 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
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 件のコメント
Jonathan Epperl
Jonathan Epperl 2012 年 10 月 14 日
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.

回答 (0 件)

この質問は閉じられています。

Community Treasure Hunt

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

Start Hunting!

Translated by