sim_len = 40;
A = zeros(sim_len, 2);
B = zeros(sim_len, 2);
A(1, :) = [0, 0];
B(1, :) = [5, 0];
for m = 2:sim_len
A(m, :) = [0, m-1];
v_AB = B(m-1, :)-A(m-1, :);
v_AB = v_AB ./ norm(v_AB);
B(m, :) = A(m-1, :) + 5.*v_AB;
end
fig = figure(); hold on;
plot(A(:, 1), A(:, 2), "*");
plot(B(:, 1), B(:, 2), "o"); hold off;