% draw a picture
clear all
clf

disp(['Starting at: ' datestr(now)])

%Original drawing
x0= [2 3 3 2 2 nan 3.5 2.5 1.5];
y0= [0 0 1 1 0 nan .5  1.5 .5];
r_ref= [x0;y0];


n = 50;  % number of drawings to make
t = linspace(0,1*pi, n);

%Loop fo animation
for i = 1:n
pause(.1);
theta = pi*sin(t(i));

R = [ cos(theta)  -sin(theta);
      sin(theta)  cos(theta)];

r = R* r_ref;  %rotated drawing

x=r(1,:);
y=r(2,:);

plot(x,y)
axis('equal'); 
axis([-4 4 -4 4]);
%hold on
shg
end

shg  % SHow Graph
disp(['Done at: ' datestr(now)])
