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 Center および File ExchangeMATLAB についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by