function tempo(xn,yn)
% disegno in moto
xmin=min(xn);xmax=max(xn); xr=(xmax-xmin)/5;
ymin=min(yn);ymax=max(yn); yr=(ymax-ymin)/5;
xmin=xmin-xr; xmax=xmax+xr;
ymin=ymin-yr; ymax=ymax+yr;

figNumber=figure('Visible','on');
    axes( ...
        'Units','normalized', ...
        'Visible','on');

    axHndl=gca;
    figNumber=gcf;
    set(axHndl, ...
        'XLim',[xmin xmax],'YLim',[ymin ymax], ...
        'Drawmode','normal', ...
        'Visible','on', ...
        'NextPlot','add', ...
        'View',[0,90]);
axis([xmin,xmax,ymin,ymax])
l=length(xn);
    head = line( ...
        'color','r', ...
        'Marker','.', ...
        'MarkerSize',20, ...
        'erase','xor',...
        'xdata',[],'ydata',[]);
    body = line( ...
        'color','b', ...
        'LineStyle','-', ...
        'erase','none',...
        'xdata',[],'ydata',[]);
    pendio=line( ...
        'color','k', ...
        'LineStyle','-', ...
        'LineWidth',2, ...
        'xdata',[],'ydata',[]);
    tramp=line( ...
        'color','k', ...
        'LineStyle','-', ...
        'LineWidth',2, ...
        'xdata',[],'ydata',[]);

for j=2:l
    x=xn(j-1);
    y=yn(j-1);
% Update the plot
x = [xn(j) x];
y = [yn(j) y];
 set(head,'xdata',x(1),'ydata',y(1));
 set(body,'xdata',x(1:2),'ydata',y(1:2));
 drawnow;
end

