I have simulated some random walkers. I used
plot(xb,yb,'b--o')
to show particles in each step. I saw a code in below link with beautiful particles with tail which moves in a blur way. Is there a way which I could my random walkers the same as the walkers in the link in mat lab? Could anyone tell me which should I use instead of the plot function I used?
The code I tried:
clear all
close all
lbox=20;
%random fluctuation
eta = (2.*pi).*.1;
vs=0.02;
n=200;
birdl=[1:n];
axis([0 lbox 0 lbox])
axis('square')
hold on
xb=rand(n,1).*lbox; %first possition
yb=rand(n,1).*lbox; %first possition
vxb = 1;
vyb = 1;
for steps=1:5000;
xb = xb + vxb;
yb = yb+ vyb;
for bird1 = 1:n;
%periodic boundary condition
if(xb(bird1)<0);xb(bird1)=xb(bird1)+lbox; end
if (yb(bird1)<0);yb(bird1)=yb(bird1)+lbox;end
if (xb(bird1)>lbox);xb(bird1)=xb(bird1)-lbox;end
if (yb(bird1)>lbox);yb(bird1)=yb(bird1)-lbox;end
end
ang=eta.*(rand(n,1)-0.5);
vxb = vs.*cos(ang);
vyb = vs.*sin(ang);
cla
set(gcf,'doublebuffer','on')
plot(xb,yb,'.b')
%quiver(xb,yb,vxb,vyb,'b')
drawnow
end