I've made this code x=[1.02,.95,.87,.77,.67,.56,.44,.3,.16,.01]';
y=[.38,.32,.27,.22,.18,.15,.13,.12,.13,.15]';
plot(x,y)
x2=x.^2;
A=[y.^2,x.*y,x,y,ones(10,1)];
z=A\x2
hold on
xp=0:.001:1;
yp=0:.001:1;
plot(z(1)*yp.^2+z(2)*xp.*yp+z(3)*xp+z(4)*yp+z(5),xp.^2) It's supposed to solve the equation a*y^2 + b*x*y + c*x + d*y + e = x^2 using least squares and then plot the solution together with the actual measured values (x and y). Why is the least squares solution a bit of? I suppose I've made some error somewhere.