If you change your first equation to this, the warning no longer crops up:
l^2 == (x-x0)^2+(y-y0)^2
I'm not sure that you actually have spurious values though. The it's possible that the square root gave solvelib::checkSolutions
trouble.
You may have thought that you had spurious values when you checked because you weren't outputting the variables correctly. You specify that solve
solve for x
, y
, l
, r
(in that order), but then you name the output variables as sol_l
, sol_r
, sol_x
, sol_y
(different order). You must use the same order as `solve cannot guess bases on the names of your variables.
Your code:
R=30;
x0=-R;
y0=0;
l0=R/100;
t0=1.2;
t=0.7071;
r0=R-l0/2;
a=[1.78E-05 3.39E-04 0.0104 -0.05791 -16.36];
[sol_x,sol_y,sol_l,sol_r] = solve(l^2 == (x-x0)^2+(y-y0)^2, ...
r == abs((x+x0)/2), ...
poly2sym(a) == y, ...
l*r*t == l0*r0*t0, ...
x,y,l,r, 'Real', true)
% Check
sol_l2.^2 - (sol_x2-x0).^2+(sol_y2-y0).^2
sol_r - abs((sol_x+x0)/2)
[subs(poly2sym(a),x,sol_x(1));subs(poly2sym(a),x,sol_x(2));...
subs(poly2sym(a),x,sol_x(3));subs(poly2sym(a),x,sol_x(4))]-sol_y;
sol_l2.*sol_r2*t - l0*r0*t0
The check returns small values close zero.