x=[0 1 2 3 4 5]; y=[10 25 51 66 97 118]; plot(x,y,'x') axis([-1 6 0 130]) xlabel('x') ylabel('y') title('Plot for Least Squares Example with polyfit') hold on c=polyfit(x,y,1) x2=linspace(0,5); plot(x2, c(1)*x2 +c(2), 'k-')