function animate(n)
set(gca,'XLim',[-2,2],'YLim',[-2,2],'Drawmode','fast',...
    'Visible','on');
cla
axis square
ball=line('color','r','Marker','o','MarkerSize',10,...
    'LineWidth',2,'erase','xor','xdata',[],'ydata',[]);
hold on;

x = @(t) 0.5+0.3*t+3.9*t.^2-4.7*t.^3;
y = @(t) 1.5+0.3*t+0.9*t.^2-2.7*t.^3;

x_p = @(t) 0.3+3.9*2*t-4.7*3*t.^2;
y_p = @(t) 0.3+0.9*2*t-2.7*3*t.^2;

t = [0, npartition(x_p,y_p,n)];

MakeQTMovie('start','even_s.mov');
MakeQTMovie('framerate', 30);
for i = 1:n
    set(ball,'xdata',x(t(i)),'ydata',y(t(i))); drawnow; pause(0.01);
    if(i > 1)
        line([x(t(i-1)),x(t(i))],[y(t(i-1)),y(t(i))]);
    end
    MakeQTMovie('addfigure');
end
MakeQTMovie('finish');

clf
set(gca,'XLim',[-2,2],'YLim',[-2,2],'Drawmode','fast',...
    'Visible','on');
cla
axis square
ball=line('color','r','Marker','o','MarkerSize',10,...
    'LineWidth',2,'erase','xor','xdata',[],'ydata',[]);
t = 0:1/n:1;

MakeQTMovie('start','even_t.mov');
MakeQTMovie('framerate', 30);
for i = 1:n
    set(ball,'xdata',x(t(i)),'ydata',y(t(i))); drawnow; pause(0.01);
        if(i > 1)
        line([x(t(i-1)),x(t(i))],[y(t(i-1)),y(t(i))]);
    end
    MakeQTMovie('addfigure');
end
MakeQTMovie('finish');
hold off;