Hi, I would need the algebraicly solved two equations for X and Y of the intersection points of two circles to write them as algorithms in a graphics language. Thanks
1 次查看(过去 30 天)
显示 更早的评论
I understand the two circles to be:
(x-x1)^2+(y-y1)^2=r1^2 (x-x2)^2+(y-y2)^2=r2^2
to be multiplied out into: (1) x^2-2*x*x1+x1^2+y^2-2*y*y1+y1^2=r1^2 (2) x^2 -2*x*x2+x2^2+y^2-2*y*y2+y2^2=r2^2
subtract (2) from (1): (3) -2*x*x1+2*x*x2+x1^2-x2^2-2*y*y1+2*y*y2+y1^2+y2^2=r1^2-r2^2
I understand that (3) should be solved for x to make the equation (4) then x in (1) to be substituted with the result and (1) solved for y, then this result again plugged into (3) to again be solved for x?
anyway, I would need the two algebraic solutions, for x and for y
thank you Karl
1 个评论
Dyuman Joshi
2023-2-8
编辑:Dyuman Joshi
2023-2-8
Yes, you can write equation (3) by separating the variables (y on the lhs and x on the rhs, as you want to solve for x) and substituting it in either (1) or (2) to get the value(s) of x.
Then, substitute the value(s) of x in any of the equation to get the corresponding value(s) of y.
回答(1 个)
Torsten
2023-2-8
syms x y x1 y1 x2 y2 r1 r2 real
eqn1 = (x-x1)^2+(y-y1)^2==r1^2;
eqn2 = (x-x2)^2+(y-y2)^2==r2^2;
sol = solve([eqn1,eqn2],[x y])
sol.x
sol.y
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Oceanography and Hydrology 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!