C1=[0,0];
C2=[5,0];
R1=3;
R2=5;
F=@(x) ([(x(1)-C1(1))^2+(x(2)-C1(2))^2-R1^2; ...
(x(1)-C2(1))^2+(x(2)-C2(2))^2-R2^2]);
opt=optimoptions(@fsolve);
opt.Algorithm='levenberg-marquardt';
opt.Display='off';
x=fsolve(F,[C1(1),C1(1)+R1],opt);
fprintf('First intersection point: (%f,%f)\n',x(1),x(2));
x=fsolve(F,[C1(1),C1(1)-R1],opt);
fprintf('Second intersection point: (%f,%f)\n',x(1),x(2));
when you run it you get:
First intersection point: (0.900000,2.861818)
Second intersection point: (0.900000,-2.861818)
The main difference here is that the initial guess or starting points is located on one of the circles (so it satisfies one of the equations and not the other. (0,0) that you start doesn't satisfies any of the equations. The convergence rate would be much worse there. setting starting guess as (x,y)=(C(1), C(2)+R) helps it, and that is always the point right on top of one of the circles. Not necessarily the intersection. And Setting the initial guess like this is by no mean any restriction, and in fact choosing proper initial guess is always encouraged.
Alternatively you could have posed this as a constrained optimization problem. Then you had more flexibility for the initial guess.
Best Answer