% ex34.m x=1:10; y=2*x+rand(1,10)-0.5; p=polyfit(x,y,1); y2=polyval(p,x); plot(x,y,'x',x,y2,'-');