Finding the intersection of a bunch of circles of different centers and radii, using FSOLVE
2 views (last 30 days)
Show older comments
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 Comments
Matt J
on 1 May 2019
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?
Answers (1)
darova
on 1 May 2019
If circles normally intersect each other they have 2 intersection points
- equation for the first circle
- equation for the second
Dont know if fsolve() can find intersection point for this:
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
2 Comments
darova
on 2 May 2019
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)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!