% lsfit.m MatLab least square fit, built in
x = [0.0 0.1  0.2 1.9]
y = [0.0 6.0 14.1 0.0]
p = polyfit(x, y, 3)
f = polyval(p, x) % for whole vector x
table = [ x' y' f' (y-f)' ] % y-f is vector of errors
plot(x,y,'o', x,f,'-')
% end lsfit.m
