load linefit.dat; x = linefit(:,1); y = linefit(:,2); xp = linspace(0,7,100); n = length(x) - 1; % Create n_th order polynomial through data: pcoeffn = polyfit(x,y,n); ypn = polyval(pcoeffn,xp); figure(1), plot(x,y,'o',xp,ypn,'m') % Create LINEAR spline through the data: yint = interp1(x,y,xp); figure(5), plot(x,y,'o',xp,yint,'m'); % Create cubic spline through data: yspline = spline(x,y,xp); figure(6), plot(x,y,'o',xp,yspline,'m')