function cost = UGcost(mb,pdata,dev)
% PLOT UPSIDE-DOWN GAUSSIAN COST FUNCTION FOR BESTLINE
% function cost = UGcost(mb,pdata,dev)

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

