function animation1D(t,x,L,pas) // animation1D(t,x,L,pas) // // t axe du temps: vecteur [nt,1] // x position des masses: matrice [nt,N] // L taille du domaine // pas l'affichage ne se fait que toutes les 'pas' valeurs // reechantillonnage des donnees [nt,N] = size(x); indice = 1:pas:nt; x = x(indice,:); t = t(indice); npas = length(t); // changement de coordonnees xpos = cos(2*%pi*x/L); ypos = sin(2*%pi*x/L); // tracage du cercle phi = linspace(0,2*%pi,300)'; xpos2 = cos(phi); ypos2 = sin(phi); // animation clf plot(xpos2,ypos2,'r-') plot(xpos(1,:),ypos(1,:),'bo') h_compound = gce(); h_compound.children.mark_size = 8; h_compound.children.mark_background = 2; h_axes = gca(); h_axes.data_bounds = [-1.1,-1.1;1.1,1.1]; h_axes.isoview = 'on'; for i=2:npas drawlater(); h_compound.children.data = [xpos(i,:)',ypos(i,:)']; drawnow(); end endfunction