Clear Filters
Clear Filters

symbolic solving system of non-linear equations

4 views (last 30 days)
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 Comment
Walter Roberson
Walter Roberson on 29 Nov 2023
For one thing, the calculation would be faster if you switched the angles to radians

Sign in to comment.

Answers (2)

Torsten
Torsten on 29 Nov 2023
Moved: Torsten on 29 Nov 2023
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 Comments
Sam Chak
Sam Chak on 29 Nov 2023
Trigonometric equations typically have multiple solutions. How do you determine which solution yields the correct result? I wonder...
Konrad
Konrad on 29 Nov 2023
This equations describes positon of 6 axes robot so I can just try the solution. I thought about @Torsten answer and this system of 12 equations should have solutions because there are denpend on each other.

Sign in to comment.


John D'Errico
John D'Errico on 29 Nov 2023
Edited: John D'Errico on 29 Nov 2023
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 Comments
Konrad
Konrad on 29 Nov 2023
it describe angles of end of robot, not angles of robot axis
Sam Chak
Sam Chak on 30 Nov 2023
If you can reduce the number of equation, try solving it again.

Sign in to comment.

Products


Release

R2023b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!