I am looking to fit a parabola to the following data.
x = [-10:2:16];
y = [0.0334,0.0230,0.0145,0.0079,0.0033,0.0009,0.0006,0.0026,0.0067,0.0130,0.0213,0.0317,0.0440,0.0580];
[p,~,~] = polyfit(x,y,2);
x2 = linspace(-10,16,100);
y2 = polyval(p,x2);
y3 = 0.0003.*x2.^2 -0.0006.*x2 + 0.0011;
figure
plot(x,y,'o',x2,y2,x2,y3)
However, the fit does not match with the data at all. After putting the data into excel and fitting using a 2nd order polynomial there, I get a very nice fit. y = 0.0003x2 - 0.0006x + 0.0011 (excel truncating the coefficients skews the fit a bit). What is happening with polyfit with this data?