Filter löschen
Filter löschen

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 Ansicht (letzte 30 Tage)
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 Kommentar
Dyuman Joshi
Dyuman Joshi am 8 Feb. 2023
Bearbeitet: Dyuman Joshi am 8 Feb. 2023
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.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Torsten
Torsten am 8 Feb. 2023
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])
Warning: Solutions are only valid under certain conditions. To include parameters and conditions in the solution, specify the 'ReturnConditions' value as 'true'.
sol = struct with fields:
x: [2×1 sym] y: [2×1 sym]
sol.x
ans = 
sol.y
ans = 

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by