function [m,b] =liner(x,y) % [m,b] = liner(x,y) % Returns the SLOPE 'm' and the Y-INTERCEPT 'b' of the % least-squares best fit line through the data pairs, 'x' and 'y'. sx = sum(x); sy = sum(y); sxy = sum(x.*y); sxx = sum(x.*x); xb = mean(x); yb = mean(y); m = (sxy - sx*yb)/(sxx - sx*xb); b = yb - m*xb; return