Using fsolve to find circle intersection

2 次查看(过去 30 天)
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 中查找有关 Startup and Shutdown 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by