Warning: Explicit solution could not be found.

조회 수: 8 (최근 30일)
Chia-Ching
Chia-Ching 2013년 2월 1일
I use 'solve' code to solve 3 variables and 3 equations.
My program is :
function QQQ=fff(u,v);
syms Xc Yc Zc;
format compact;
format long;
r=7;
Xa=-0.50028822921022;
Ya=0;
Za=5.00288229210220;
Xo=6.25865746822572;
Yo=1.69110011226519;
Zo=5.67877686184579;
sol=solve((Xa-Xo)*(Xc-Xo)+(Ya-Yo)*(Yc-Yo)+(Za-Zo)*(Zc-Zo)-r*r*cosd(18.60992783662224),(Xo-Xa)*(Xc-Xa)+(Yo-Ya)*(Yc-Ya)+(Zo-Za)*(Zc-Za)-2*(r^2)*sind(9.30496391831112)*cosd(80.69503608168888),(Xo-Xc)*(Xa-Xc)+(Yo-Yc)*(Ya-Yc)+(Zo-Zc)*(Za-Zc)-2*(r^2)*sind(9.30496391831112)*cosd(80.69503608168888),Xc,Yc,Zc)
But result is :
Warning: Explicit solution could not be found.
> In solve at 140
In sym.solve at 49
In SLP2 at 12
sol =
[ empty sym ]
I want to find Xc、Yc、Zc answer.
How can I do ?

채택된 답변

Walter Roberson
Walter Roberson 2013년 2월 2일
If you add together your first two equations and simplify(), you will find that Xc, Yc, and Zc all drop out, leaving a constant. As the right side of the two is implicitly 0, and 0+0=0 but adding the two does not give 0, the equations are inconsistent, so there is no solution to the trio of equations.
  댓글 수: 1
Chia-Ching
Chia-Ching 2013년 2월 2일
Ok,thank you. I must be create new equation,maybe have solution.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Matt Tearle
Matt Tearle 2013년 2월 1일
편집: Matt Tearle 2013년 2월 1일
solve is trying to do an analytic solve, which turns out to be too hard to do. But everything in your equations are defined numerically (except the variables you're trying to solve for), so are you trying to get numerical values for the unknowns, or do you need the formulae for some reason? If you just need the values, you could use fsolve (if you have Optimization TB):
r=7;
Xa=-0.50028822921022;
Ya=0;
Za=5.00288229210220;
Xo=6.25865746822572;
Yo=1.69110011226519;
Zo=5.67877686184579;
sol=fsolve(@(Xc) [(Xa-Xo)*(Xc(1)-Xo)+(Ya-Yo)*(Xc(2)-Yo)+(Za-Zo)*(Xc(3)-Zo)-r*r*cosd(18.60992783662224),(Xo-Xa)*(Xc(1)-Xa)+(Yo-Ya)*(Xc(2)-Ya)+(Zo-Za)*(Xc(3)-Za)-2*(r^2)*sind(9.30496391831112)*cosd(80.69503608168888),(Xo-Xc(1))*(Xa-Xc(1))+(Yo-Xc(2))*(Ya-Xc(2))+(Zo-Xc(3))*(Za-Xc(3))-2*(r^2)*sind(9.30496391831112)*cosd(80.69503608168888)],rand(3,1))
But... it looks like your equations are actually linear in Xc, Yc, Zc. So I'd suggest rearranging the equations in matrix-vector form and solve with \. EDIT TO ADD Oops, no, I just noticed that the last equation is quadratic in Xc, Yc, Zc. Never mind.
(Also, this all seems to be happening inside a function, with no reference to the function inputs. This is inefficient if the function is going to be called numerous times, because solving these equations is independent of the function inputs and will therefore produce the same result each time.)
  댓글 수: 1
Chia-Ching
Chia-Ching 2013년 2월 2일
My 3 equations is derive from 3 points o(Xo,Yo,Zo)、a(Xa,Ya,Za) and c(Xc,Yc,Zc),use 3 points to construct a triangle in 3D place. o and a is known,c is unknown,use 2 points to find c point. Fsolve is find a lot of points,or maybe my equations is really a lot of solution,so can't find one solution.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Systems of Nonlinear Equations에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by