function lsp(Xdata,Ydata,deg,xplot) % Given data points Xdata and Ydata this routine plots % the least squares fit polynomial of degree deg. The % plot of the polynomial is performed at the abscissas % given by xplot. % Mth 355 Fall 2001 % The declaration % % function lsp(Xdata,Ydata,deg,xplot) % % shows this m-file returns no value. p = polyfit(Xdata,Ydata,deg); q = polyval(p,xplot); plot(xplot,q,'c',Xdata,Ydata,'oy')