Solving non linear equation "Circle" equations
Mostrar comentarios más antiguos
Hello I have a 20 non linear equations that I want to solve, I started with only three to check if it would be working but I always get an empty vector. I do not get any answers.
syms xa ya
eq1 = xa^2 + ya^2 == 84.4^2;
eq2 = (xa-40)^2 + ya^2 == 68^2;
eq3 = (xa-100.66)^2 + (ya-49.07)^2 == 52.59^2;
sol = solve([eq1, eq2, eq3],[xa,ya])
for example the above 3 circles intersect at one point which should be (51.24, 67.06) but I always get an empty object. I know I can solve each 2 of them seperately and compare results, but my main object is to solve 20 equations with 15 unknowns at once.
but even for 2 unknowns I do not get answers.
sol =
struct with fields:
xa: [0×1 sym]
ya: [0×1 sym]
5 comentarios
for example the above 3 circles intersect at one point which should be (51.24, 67.06)
This point doesn't even solve the first equation:
xa=51.24;
ya=67.06;
xa^2 + ya^2 == 84.4^2
Ahmed Ashour
el 15 de Sept. de 2021
Nope. Let's compute the difference,
(51.24 ^ 2 + 67.06 ^ 2) - 84.4^2
Ahmed Ashour
el 15 de Sept. de 2021
Matt J
el 15 de Sept. de 2021
So, write the complete number and we will check that too.
Respuesta aceptada
Más respuestas (2)
syms xa ya R3
xc = [0; 40; 100.66];
yc = [0; 0; 49.07];
r3 = 52.59;
R = [84.4; 68; R3];
eqn = (xa-xc).^2 + (ya-yc).^2 == R.^2;
sol = solve(eqn(1:2), [xa, ya])
sol.xa
sol.ya
r3_needed = sqrt(lhs(vpa(subs(eqn(3), sol))))
r3_needed - r3
RR = double([R(1:2); r3_needed(2)]);
viscircles([xc, yc], RR, 'Color', 'k')
hold on
scatter(sol.xa, sol.ya, 60, 'r+')
hold off
Bjorn Gustavsson
el 15 de Sept. de 2021
0 votos
If the 20 equations are of the same form you will have a vastly overdetermined problem (that in general will not have any exact solution which will lead you to some kind of least-squares like solutions). The most natural first-stab might be to simply solve pairwise problems and then check if you have any common solution to all (or some subsets).
3 comentarios
Ahmed Ashour
el 15 de Sept. de 2021
Bjorn Gustavsson
el 15 de Sept. de 2021
Why indeed? Because the way you described the problem...
So you want to find out the issue with your real problem or the problem you posted? The first problem is due to the fact that Matt J showed - the representation of the numbers you wrote doesn't match the first equation, and most likely the symbolic interpretation of the exact numbers you were thinking of doesn't either. Then you have your real problem of 20 nonlinear equations in (what you now revealed to be) some number of unknowns that is larger than 2. You don't give us much to work with, do you? We could provide a couple of guesses:
1, you have at least some equation something like this: 
2, your system of equations ends up with some polynomial of degree higher than 5.
Ahmed Ashour
el 16 de Sept. de 2021
Categorías
Más información sobre Mathematics en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


