function cost = LScost(mb,pdata)
% PLOT LEAST-SQUARES COST FUNCTION FOR BESTLINE
% function cost = LScost(mb, pdata)

errs = polyval(mb,pdata.Xdata) - pdata.Ydata;
cost = sum(errs.^2);
