Finding the intersection of a bunch of circles of different centers and radii, using FSOLVE

2 ビュー (過去 30 日間)
Nikunj Patel
Nikunj Patel 2019 年 5 月 1 日
コメント済み: darova 2019 年 5 月 2 日
Write a Matlab routine to find the intersection of a bunch of circles of different centers and radii. You should expect around 5 to 10 circles, and also anticipate that the intersection may not be perfect, we use the data for the 5 circles centers and radii given in the table provided. How am i meant to solve this, we were told to use either fsolve or lsqnonlin, if someone could help me produce a code for this much will be appreciated
  2 件のコメント
Matt J
Matt J 2019 年 5 月 1 日
How am i meant to solve this, we were told to use either fsolve or lsqnonlin
If you were told which command to use, isn't the "how" of it already answered?
Nikunj Patel
Nikunj Patel 2019 年 5 月 1 日
Sorry i meant what would the code look like, im new to matlab

サインインしてコメントする。

回答 (1 件)

darova
darova 2019 年 5 月 1 日
If circles normally intersect each other they have 2 intersection points
- equation for the first circle
- equation for the second
im1.png
Dont know if fsolve() can find intersection point for this:
m2.png
For example, code for lines intersection using fsolve():
clc, clear, cla
x = [0 4];
k1 = 1;
k2 = 3;
y1 = k1.*x+2;
y2 = k2.*x;
F = @(x) [x(2) - k1*x(1)-2
x(2) - k2*x(1)];
x0 = [0 0];
xx = fsolve(F,x0);
hold on
plot(x,y1)
plot(x,y2)
plot(xx(1),xx(2),'or')
hold off
m1.png
  2 件のコメント
Nikunj Patel
Nikunj Patel 2019 年 5 月 1 日
how would i do it in this case, im still struggling
darova
darova 2019 年 5 月 2 日
You have 5 circles. If you want to compute intersection of the first two - draw them first to see where they intersect (more or less) for initial guess
clc, clear
t = linspace(0,2*pi,50);
x1 = -7.37 + 7.8*cos(t);
y1 = 7.65 + 7.8*sin(t);
x2 = 3.51 + 5.6*cos(t);
y2 = 1.05 + 5.6*sin(t);
plot(x1,y1,x2,y2)

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeProgramming についてさらに検索

製品


リリース

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by