x=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
y=[1.2, 3, 4, 4, 5, 4.7, 5, 5.2, 6, 7.2]
p2=polyfit(x,y,2)
p3=polyfit(x,y,3)
y2=polyval(p2,x)
y3=polyval(p3,x)
hold on
plot(x,y2,"r")
plot(x,y3,"b")
plot(x,y,"*")
x=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
y=[1.2, 3, 4, 4, 5, 4.7, 5, 5.2, 6, 7.2]
p2=polyfit(x,y,2)
p3=polyfit(x,y,3)
y2=polyval(p2,x)
y3=polyval(p3,x)
hold on
plot(x,y2,"r")
plot(x,y3,"b")
plot(x,y,"*")