for文で行列全体を1つの要素として繰り返す
Show older comments
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
Accepted Answer
More Answers (0)
Categories
Find more on Logical 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!