フィルターのクリア

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 日間)
Karl
Karl 2023 年 2 月 8 日
回答済み: Torsten 2023 年 2 月 8 日
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
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
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])
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 = 

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by