function BestLineLS(pdata)

figure(1)
subplot(1,1,1)
plotcol = 'k*';
deg = 1;
[P,S] = polyfit(pdata.Xdata,pdata.Ydata,deg);
hold off
plot(pdata.Xdata,pdata.Ydata,plotcol);
hold on
plot(0:.001:1,polyval(P,0:.001:1),'r');
axis([0,1,0,1])
disp(['y = m*x + b where m = ',num2str(P(1)),' and b = ',num2str(P(2))]);
H = xlabel('x');
set(H,'FontSize',14);
H = ylabel('y');
set(H,'FontSize',14);
H = title('Data And Best Line (in Least Squares Sense)');
set(H,'FontSize',14);
