6 eqn with 6 unknown Cannot find explicit solution
1 次查看(过去 30 天)
显示 更早的评论
I can't get this to work, what am I doing wrong?
clear
clc
%delaring syboluc variables
syms x y z Roll Pitch Yaw
syms o1 o2 o3 o4 o5 o6
%distance between joints
L1 = 0.08917; %m
L2 = 0.1357; %m
L3 = 0.51416-L1; %m
L4 = 0.39225; %m
L5 = L2-0.10916; %m
L6 = 0.51416-0.41951; %m
L7 = 0.47455-L4; %m
%transformation matixes for joints 1-6
T_1 = [cos(o1), -sin(o1), 0, 0;
sin(o1), cos(o1), 0, 0;
0, 0, 1, L1;
0, 0, 0, 1];
T_2 = [cos(o2), -sin(o2), 0, 0;
sin(o2)*cosd(90), cos(o2)*cosd(90), -sind(90), -sind(90)*L2;
sin(o2)*sind(90), cos(o2)*sind(90), cosd(90), cosd(90)*L2;
0, 0, 0, 1];
T_3 = [cos(o3), -sin(o3), 0, -L3;
sin(o3), cos(o3), 0, 0;
0, 0, 1, 0;
0, 0, 0, 1];
T_4 = [cos(o4), -sin(o4), 0, -L4;
sin(o4), cos(o4), 0, 0;
0, 0, 1, -L5;
0, 0, 0, 1];
T_5 = [cos(o5), -sin(o5), 0, 0;
sin(o5)*cosd(90), cos(o5)*cosd(90), -sind(90), -sind(90)*L6;
sin(o5)*sind(90), cos(o5)*sind(90), cosd(90), cosd(90)*L6;
0, 0, 0, 1];
T_6 = [cos(o6), -sin(o6), 0, 0;
sin(o6)*cosd(-90), cos(o6)*cosd(-90), -sind(-90), -sind(-90)*L7;
sin(o6)*sind(-90), cos(o6)*sind(-90), cosd(-90), cosd(-90)*L7;
0, 0, 0, 1];
%matrix for base to wrist
T = T_1*T_2*T_3*T_4*T_5*T_6;
simplify(T);
beta = atan((-T(3,1))/(((T(1,1))^2+(T(2,1))^2)^0.5));
simplify(beta);
eqn1 = beta == Roll*(pi/180);
eqn2 = atan(((T(2,1))/(cos(beta)))/((T(1,1))/(cos(beta)))) == Pitch*(pi/180);
eqn3 = atan(((T(3,2))/(cos(beta)))/((T(3,3))/(cos(beta)))) == Yaw*(pi/180);
eqn4 = T(1,4) == x;
eqn5 = T(2,4) == y;
eqn6 = T(3,4) == z;
sol = solve([eqn1, eqn2, eqn3, eqn4, eqn5, eqn6], [o1, o2, o3, o4, o5, o6]);
o1 = sol.o1
o2 = sol.o2;
o3 = sol.o3;
o4 = sol.o4;
o5 = sol.o5;
o6 = sol.o6;
0 个评论
回答(1 个)
Mukul Rao
2017-4-24
Hi,
In some cases involving complex non-linear equations such as the one in this post, solve cannot find an explicit solution even with state of the art algorithms due to inherent limitations of the algorithms.
Your best bet in such a case would be to try some of the troubleshooting steps outlined here:
Given that your equations involve several levels of trigonometric functions that are periodic, I can foresee the solution space to have a lot of wiggles leading to convergence issues.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Specialized Power Systems 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!