二重のfor文による行列への出力
Show older comments
上段右辺のインデックス付けされているclaやcd、clは56×41のデータがそれぞれ入っており、その他の文字は定数その他の文字は定数値です。c11~c33などはA,B行列の各要素でありc21以降はこの場では省略しております。二重のfor文によってA,B行列を56×41通りだしたいのですがA,B行列もインデックス付けされてしまいうまくいきません。
for j=1:size(cla,2)
for l=1:size(cla,1)
c11(l,j)=-ro.*v.*s(l,j).*cd(l,j)./m;
c12(l,j)=ro.*v.^2.*s(l,j)./(2.*m).*(-cd(l,j)+cl(l,j)./57.3);
c14=-g/57.3;
A(l,j)=[c11(l,j) c12(l,j) 0 c14;
c21(l,j) c22(l,j) c23 0;
c31(l,j) c32(l,j) c33(l,j) 0;
0 0 1 0];
B(l,j)=[0;
d21(l,j);
d31(l,j);
0];
end
end
理想は4×4のA,B行列が56×41通り出せることです。
Categories
Find more on Matrix Indexing 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!