Using fsolve to find circle intersection

조회 수: 3 (최근 30일)
Erica Dawn Miller
Erica Dawn Miller 2021년 4월 8일
답변: Khalid Mahmood 2021년 4월 8일
Hello, I have to use fsolve to find where these two circles interact. If anyone has any advice as to where to get started, I would greatly appreciate it.
(x-2)^2 + (y-2)^2 =16
(x-5)^2 + (y-6)^2 =2

답변 (1개)

Khalid Mahmood
Khalid Mahmood 2021년 4월 8일
convert 2 equations into 2 functions F(1),F(2) . This is one way but other ways like F=@x [ eq1; eq2] can also be used.
function call_fSolve
fun=@nonL
x0=[0;0]; %initial values
%Let x(1)=x, x(2)=y;
options = optimoptions('fsolve','Display','iter');
[x,fval] = fsolve(fun,x0,options);
end
function F = nonL(x)
F(1) = (x(1)-2)^2 + (x(2)-2)^2 -16
F(2) = (x(1)-5)^2 + (x(2)-6)^2 -2
end

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by