% polynomial fit of Runge's function x = (-1: 0.2: 1)'; y = 1./(1+25*x.^2); p = polyfit(x,y,10) f = polyval(p,x); table = [x y f y-f] xx=(-1:0.01:1)'; yy = 1./(1+25*xx.^2); ff = polyval(p,xx); plot(xx,yy,'o',xx,ff)