symbolic solving system of non-linear equations
Mostra commenti meno recenti
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 Commento
Walter Roberson
il 29 Nov 2023
For one thing, the calculation would be faster if you switched the angles to radians
Risposte (2)
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.
John D'Errico
il 29 Nov 2023
Modificato: John D'Errico
il 29 Nov 2023
1 voto
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 Commenti
Konrad
il 29 Nov 2023
John D'Errico
il 29 Nov 2023
Modificato: John D'Errico
il 29 Nov 2023
Sorry, but you clearly don't understand me correctly. YOU CANNOT DO IT. Not in a finite amount of time, even if it is possible. Symbolic solvers end up generating millions of terms for this sort of problem, and that means the time required and the memory requirements, even if a solution exists, will be immense.
You have 12 equations. You have 6 unknowns. That makes it an over-determined problem, so more equations than variables. As such, it will almost always not have an exact solution.
Just wanting something to exist does not make that happen, well, not unless you have a magic wand, and I do not think your name is Harry Potter.
All of this means that IF you want to solve the problem, the only way to do so is using numerical solvers. Now go back and re-read the responses you have gotten.
Konrad
il 29 Nov 2023
Sam Chak
il 29 Nov 2023
Hi @Konrad
If you can explain a bit more about the 12 (or 6) equations of the 6-axis robot arm (manipulator), and what to do with the 6 joint angles (theta1 to theta6), perhaps we can advise you how to solve the math problem in some ways.
Also, if I'm not mistaken, some joint angles cannot freely rotate from 0° to 360°. These are constraints of the problem.
Konrad
il 29 Nov 2023
Konrad
il 29 Nov 2023
Sam Chak
il 29 Nov 2023
What do you mean by "9 equations are dependent"? If they depend on each other, how exactly do they depend on each other?
You have 3 of 12 equations that describe the end position of the robot.
And then you have the 4th equation describe angles of robot.
Is the 5th equation derived from the 4th equation?
Is the 6th equation derived from the 5th equation or the 4th equation?
Konrad
il 29 Nov 2023
Konrad
il 29 Nov 2023
Categorie
Scopri di più su Calculus in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
