I am looking to solve for the three theta's using sys in an array. How should my code look to make this happen. Heres what I have:
1 回表示 (過去 30 日間)
古いコメントを表示
syms theta1 theta2 theta3
eq1 = theta1 == 90-asin((L1-hblock_sub-h_ram-L3*sin(theta2)-L4*sin(theta3))/L5);
eq2 = theta2 == acos(-(L6-L4*cos(theta3)-L5*cos(90-theta1))/L3);
eq3 = theta3 == acos((L6+L3*cos(theta2)-L5*cos(90-theta1))/L4);
sol = solve([eq1 eq2 eq3],[theta1 theta2 theta3]);
hblock = subs(sol.theta1,theta2,theta3);hblock_sub = double(hblock_sub);
1 件のコメント
回答 (1 件)
Shushant
2023 年 3 月 13 日
From my understanding of your issue, you are trying to solve a set of equations but instead of declaring "theta1", "theta2" and "theta3" separately you want to declare them as part of an array. To accomplish this, you can look through this documentation here. I have tried to implement the same using some random values below.
syms theta [1 3]
L1 = 1;
L2 = 2;
L3 = 3;
L4 = 4;
L5 = 5;
L6 = 6;
hblock_sub = 1;
h_ram = 1;
eq1 = theta1 == 90-asin((L1-hblock_sub-h_ram-L3*sin(theta2)-L4*sin(theta3))/L5);
eq2 = theta2 == acos(-(L6-L4*cos(theta3)-L5*cos(90-theta1))/L3);
eq3 = theta3 == acos((L6+L3*cos(theta2)-L5*cos(90-theta1))/L4);
sol = solve([eq1 eq2 eq3],[theta1 theta2 theta3])
hblock = subs(sol.theta1,theta2,theta3)
hblock_sub = double(hblock_sub)
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Symbolic Math Toolbox についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!