Using fsolve to find circle intersection

14 views (last 30 days)
Erica Dawn Miller
Erica Dawn Miller on 8 Apr 2021
Answered: Khalid Mahmood on 8 Apr 2021
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

Answers (1)

Khalid Mahmood
Khalid Mahmood on 8 Apr 2021
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

Community Treasure Hunt

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

Start Hunting!

Translated by