function animation2D(t,x,y,L,pas) // animation2D(t,x,y,L,pas) // // t axe du temps: vecteur [nt,1] // x position des masses: matrice [nt,N] // y 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,:); y = y(indice,:); t = t(indice); npas = length(t); if max(x)>L | max(y)>L then error('** les positions dépassent la taille L **') end // animation clf plot([0 1 1 0 0]*L,[0 0 1 1 0]*L,'r-') plot(x(1,:),y(1,:),'bo') h_compound = gce(); h_compound.children.mark_size = 8; h_compound.children.mark_background = 2; h_axes = gca(); h_axes.data_bounds = [0, 0; L, L]; h_axes.isoview = 'on'; for i=2:npas drawlater(); h_compound.children.data = [x(i,:)',y(i,:)']; drawnow(); end endfunction