필터 지우기
필터 지우기

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
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 CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by