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!