symbolic solving system of non-linear equations
7 次查看(过去 30 天)
显示 更早的评论
I have system of 12 equations, they look something like these.
equation1 = - cos((pi*theta6)/180)*(sin((pi*theta5)/180)*(cos((pi*theta1)/180)*cos((pi*theta2)/180)*sin((pi*(theta3 - 90))/180) - cos((pi*theta1)/180)*sin((pi*theta2)/180)*cos((pi*(theta3 - 90))/180)) - cos((pi*theta5)/180)*(cos((pi*theta4)/180)*(cos((pi*theta1)/180)*cos((pi*theta2)/180)*cos((pi*(theta3 - 90))/180) + cos((pi*theta1)/180)*sin((pi*theta2)/180)*sin((pi*(theta3 - 90))/180)) + sin((pi*theta1)/180)*sin((pi*theta4)/180))) - sin((pi*theta6)/180)*(sin((pi*theta4)/180)*(cos((pi*theta1)/180)*cos((pi*theta2)/180)*cos((pi*(theta3 - 90))/180) + cos((pi*theta1)/180)*sin((pi*theta2)/180)*sin((pi*(theta3 - 90))/180)) - cos((pi*theta4)/180)*sin((pi*theta1)/180))==cos(pi*b1/180);
How I can transform them to get symbolic value of theta1...theta6? I tried to use solve() but my computer is working for 6 days and I still do not have any resoult.
sol = solve([equation1, equation2, equation3, equation4, equation5, equation6, equation7, equation8, equation9, equation10, equation11, equation12], [theta1, theta2, theta3, theta4, theta5, theta6], 'ReturnConditions', true);
Can I do it in easier and faster way?
1 个评论
Walter Roberson
2023-11-29
For one thing, the calculation would be faster if you switched the angles to radians
回答(2 个)
Torsten
2023-11-29
移动:Torsten
2023-11-29
A system of 12 equations in 6 unknowns usually has no solution since it is overdetermined. Or can you extract 6 of the 12 equations, solve them and the solution will also satisfy the remaining 6 ? If this is not the case, try a numerical solver, e.g. lsqnonlin, which is especially suited for overdetermined nonlinear systems of equations.
3 个评论
John D'Errico
2023-11-29
编辑:John D'Errico
2023-11-29
Solve does not apply to over-determined problems. But it does not know there may be some exact solution that solves the entire ssytem exactly. So it keeps on trying to find one. Worse, is that problems like this in symbolic form will end up with literally millions of terms. So the computations are incredibly time and memory consuming.
DON'T USE SOLVE! At best, you will need to use a numerical solver, perhaps lsqnonlin is best here for the over-determined problem. (Not vpasolve either.)
HOWEVER, remember there will be infinitely many solutions, if there are any. This is always the case for trig problems. But as much, remember there will be multiple solutions of a subtly different form. For example, what are the solutions to a problem as simple as
sin(x) == 1/2
You should see that x==pi/6 or 5*pi/6 are both solutions (30 or 150 degrees for you), and they come from different parts of the curve. As such, they can be viewed as are fundamentally different solutions. They may have different character in your problem, and some of these solutions may be more or less appropriate. This means you need to use intelligently chosen starting values.
12 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Robotics 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!