for文で行列全体を1つの要素として繰り返す
Afficher commentaires plus anciens
for文を使って i 番目の行列を求めようとしています。
i 番目のTh1,Th2,Th3を使って i 番目のJ(2×3行列)を求めたいです。
行列の要素ではなく、2×3の行列全体を i 番目と指定することはできますか。
よろしくお願いいたします。
for i=1:n
if 0<=c_q(i,2) && c_q(i,2)<=360
Th1(i,1) = pi+pi/2+a_h_step(i,2)+q0hr(i,2);
Th2(i,1) = -q0kr(i,2)-a_k_step(i,2);
Th3(i,1) = pi/2-(a_a_step(i,2)+q0ar(i,2));
J = [
-L1*sin(Th1(i,1))-L2*sin(Th1(i,1)+Th2(i,1))-L3*sin(Th1(i,1)+Th2(i,1)+Th3(i,1)), -L2*sin(Th1(i,1)+Th2(i,1))-L3*sin(Th1(i,1)+Th2(i,1)+Th3(i,1)), -L3*sin(Th1(i,1)+Th2(i,1)+Th3(i,1));
L1*cos(Th1(i,1))+L2*cos(Th1(i,1)+Th2(i,1))+L3*cos(Th1(i,1)+Th2(i,1)+Th3(i,1)), L2*cos(Th1(i,1)+Th2(i,1))+L3*cos(Th1(i,1)+Th2(i,1)+Th3(i,1)), L3*cos(Th1(i,1)+Th2(i,1)+Th3(i,1));
];
end
end
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Logical dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!