function [m,b]=fit(x,y)
% Least squares fit of two vectors X and Y.

a = sum(x.*x);
b = sum(x);
c = prod(size(x));

r=[a b; b c]\[sum(x.*y); sum(y)];

m = r(1);
b = r(2);
