%                      lagran.m
%                   little drifter expts.

x=-.5:.2:.5;
x=concat(x,x,x,x,x,x);
y=remat(x,6);
y=y';
y=y(:);
x=x(:);
shear=.3;
u0=1;
v0=1;
dt=.25;

for i=1:100
	t=i*dt;
	xout(:,i)=x;
	yout(:,i)=y;
	u=u0*cos(t);
	v=v0*cos(t+pi/4);
	x=x+dt*(u+shear*(y-.5));
	y=y+dt*v;
end
hold off
axis([min(xout(:)),max(xout(:)),min(xout(:)),max(xout(:))]);
plot(xout(:,1),yout(:,1),'x');
plot(xout(:,100),yout(:,100),'x');
hold on

for j=1:6:length(x)
  plot(xout(j,:),yout(j,:),xout(j+1,:),yout(j+1,:),xout(j+2,:),yout(j+2,:),..
       xout(j+3,:),yout(j+3,:),xout(j+4,:),yout(j+4,:),xout(j+5,:),yout(j+5,:))

end



