% Run LeastSq.m first

close all

D = 10*rand(2,10);
x = 1:10;
a = 2;
b = 5;

y = a + b*x;
D = [x;y+ -10+20*rand(1,10)];

[v,x,y] = LeastSq(1,D)

[v,x,y] = LeastSq(1,D)

xx = 0:10; yy = v(1) + v(2)*xx;

hold on; 
plot(D(1,:),D(2,:),'.b')
hold on; 
plot(xx,yy,'r-');


