% initial positions 
x = [1; 0.5];
y = [0;   0];

% new figure window
figure

% plot the particle and save the handle to the plot-data
h = plot(x, y, 'ko', 'MarkerFaceColor', 'k');

% fix handle to title
ht = title('0');

% fix the axis scaling
axis equal
axis(1.1 * [-1 1 -1 1])

factor = 0.05; % controls the update of the angle

% animation loop
for time_step = 1:1000
  angle = time_step * factor;

  % compute new position
  x(1) = cos(angle);
  x(2) = 0.5 * x(1);
  y(1) = sin(angle);
  y(2) = -0.5 * y(1);

  % update position
  set(h, 'XData', x, 'YData', y)

  % update title
  set(ht, 'String', num2str(time_step), 'FontSize', 16, 'FontWeight', 'Bold')

  % wait and force drawing
  pause(0.05)
end
