How to solve 2 non linear circle equations with vector inputs?
Show older comments
So I have 2 circles that intersect and im trying to solve for those intersection points but also the larger circle in this case f(1) or the circle with the C variables has a variable centre. The centre of the larger circle has different postions on a path and im aiming to find the intersection points as the larger cricle moves. Here is my function:
function f=f_lower(x)
xx=x(1);
yy=x(2);
%the displacement in vector form
dy=linspace(-20,59);
yl0=103.3;
yl1=yl0+dz;
hl0=20;
kl0=103.3;
CD=485.6445;
%the path the centre follows is also an arc
xl1=sqrt((CD^2)-((yl1-kl0).^2))+hl0;
%the new centre values
Ch=xl1;
Ck=yl1;
Cr=542.206;
%smaller cirlce centres/radius
Gh=240.941;
Gk=576.502;
Gr=68.75;
f(1)=(Cr^2)==((xx-Ch).^2)+((yy-Ck).^2);
f(2)=(Gr^2)==((xx-Gh)^2)+((yy-Gk)^2);
end
And then my function in the editor is:
fun=@f_lower;
fsolve(fun,[293.693,602.363])
I found my first intersection using desmos to get my "x0" value in the function for it to solve from.
Still it doesnt work and I can not see why. Any help would be great.
Answers (1)
Torsten
on 9 Mar 2022
f(1)=(Cr^2)-((xx-Ch)^2)+((yy-Ck)^2);
f(2)=(Gr^2)-((xx-Gh)^2)+((yy-Gk)^2);
instead of
f(1)=(Cr^2)==((xx-Ch)^2)+((yy-Ck)^2);
f(2)=(Gr^2)==((xx-Gh)^2)+((yy-Gk)^2);
Categories
Find more on Systems of Nonlinear Equations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!