%% Demo: random points on a line in 2D

a = [2 3];
q = [-1 4];

figure(1); clf;
lw = 'linewidth';
plot([0 a(1)], [0 a(2)], 'r-', lw, 3);
hold on
plot([0 q(1)], [0 q(2)], 'b-', lw, 3);
plot([0 a(1)]+q(1), [0 a(2)]+q(2), 'r-', lw, 6);

axis equal
grid on

xlabel('x'); ylabel('y');

for i=1:1000
  s = 4*rand()-2;
  % s = i/500  % or think of s like time
  x = q + s*a;
  plot(x(1), x(2), 'k.', lw, 2)
  drawnow()
end
