
nframes=200;
ts=0;
tend=4*pi;

 
t=linspace(ts,tend,nframes);
xx=cos(t); yy=sin(t);

in=1;
for i=2:nframes;
    
    tt=linspace(ts,t(i),i);
    x=cos(tt); y=sin(tt);
    plot(xx,yy); hold on;
    plot(x,y,'r-'); 
    plot(x(i),y(i),'ro');

axis([-1.5 1.5 -1.5 1.5]);
box on;
grid on;
axis equal;
title('f(t)=cos(t) {\bf i} + sin(t) {\bf j}, t \in [0, 4\pi]');
xlabel('x');
ylabel('y');
tt=ts+i*(tend-ts)/nframes;
tt=tt/pi;
 tname=['t=' num2str(tt) 'pi'];
 text(x(i),y(i),tname);
 melps(in)=getframe;
 in=in+1;
%clf('reset');
hold off;
end;
in=in-1;

%for n=1:in;
%[xe,map1]=frame2im(melps(:,n));
%fname=['' num2str(n) 'cc2d.jpg'];
%imwrite(xe,fname, 'jpeg');
%end;

%np=1;
%fps=10;

%movie(melps,np,fps);
