How to solve a system of equations?

조회 수: 2 (최근 30일)
Dzung Tu
Dzung Tu 2022년 7월 19일
답변: John D'Errico 2022년 7월 19일
Hi, guys
I'd tried to solve this system of equations but it took too long that it didnt return any answer. Here is the code i used
syms rf re rb rp t1 t2 t3 al1 al2 z
xJ1 = rf*cos(t1) + rb;
yJ1 = 0;
zJ1 = rf*sin(t1);
xJ2 = -(rf*cos(t2)+rb)/2;
yJ2 = (rf*cos(t2)+rb)*sqrt(3)/2;
zJ2 = rf*sin(t2);
xJ3 = -(rf*cos(t3)+rb)/2;
yJ3 = -(rf*cos(t3)+rb)*sqrt(3)/2;
zJ3 = rf*sin(t3);
xP1 = rp*cos(al2);
yP1 = 0;
zP1 = z - rp*sin(al2);
xP2 = (rp*sin(al1)*sin(al2)*sqrt(3)-rp*cos(al2))/2;
yP2 = rp*cos(al1)*sqrt(3)/2;
zP2 = z + rp*sin(al2)/2 + rp*sin(al1)*cos(al2)*sqrt(3)/2;
xP3 = (-rp*sin(al1)*sin(al2)*sqrt(3)-rp*cos(al2))/2;
yP3 = -rp*cos(al1)*sqrt(3)/2;
zP3 = z + rp*sin(al2)/2 - rp*sin(al1)*cos(al2)*sqrt(3)/2;
pt1 = (xP1-xJ1)^2 + (yP1-yJ1)^2 + (zP1-zJ1)^2 == re^2;
pt2 = (xP2-xJ2)^2 + (yP2-yJ2)^2 + (zP2-zJ2)^2 == re^2;
pt3 = (xP3-xJ3)^2 + (yP3-yJ3)^2 + (zP3-zJ3)^2 == re^2;
eqns = [pt1 pt2 pt3];
Q = solve(eqns,al1,al2,z,'Real',true);
I want to solve al1, al2, z with rf, re, rb, rp, t1, t2, t3 are parameters.
Can anyone help me?

답변 (1개)

John D'Errico
John D'Errico 2022년 7월 19일
pt1, pt2, and pt3 are the equations of the surfaces of three spheres, each wih the same fixed, but unspecified radius.
Pick any two of those spheres. If an intersectino exists, then it will be in the form of the perimeter of some circle, floating in space. Or, the two spheres may touch at a single point (thus a degenerate circle) or no solution at all may exist if the centers of the spheres are too far apart.
Now take the third sphere. Does it intersect that circle? It may, or it may not. If a solution exists, it may be in the form of the entire circle, or one or two points, or possibly there is no real soution at all.
So does a solution exist? Perhaps. But it will be a nasty looking thing, dependent on many possible cases, with many possible scenarios. And all of this depends on multiple parameters that enter into the system in a nonlinear way.
If the parameters have KNOWN values, so all of rf, re, rb, rp, t1, t2, t3 are given, then you could use a numerical solver, perhaps fsolve, or vpasolve. Otherwise, good luck in your quixotic questing for a magical solution.

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by