for ループの全データ取得
Show older comments
お世話になっております。TDUの井上です.
下記のコードにてforループの100回の全データをすべて取得したいのですが,うまくできません.
(100回目のデータしか取得できません)
ご指導ください.
L1=1;L2=1;L3=1; % 変数宣言
theta1=0;theta2=0;theta3=0; % 変数宣言
posi3=[0; 0; L3; 1]; % 手先位置(手先座標系)
for i=1:100
theta1=theta1+0.1;theta2=theta2+0.1;theta3=theta3+0.1;
trans01=[cos(theta1) -sin(theta1) 0 0; % 3×3行列
sin(theta1) cos(theta1) 0 0;
0 0 1 0;
0 0 0 1];
trans12=[cos(theta2) 0 sin(theta2) 0; % 3×3行列
0 1 0 0;
-sin(theta2) 0 cos(theta2) L1;
0 0 0 1];
trans23=[cos(theta3) 0 sin(theta3) 0; % 3×3行列
0 1 0 0;
-sin(theta3) 0 cos(theta3) L2;
0 0 0 1];
posi0=trans01*trans12*trans23*posi3;
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!