%%
% Ten Brownian walks
str = {'Name1','Name2','Name3','Name4','Name5','Name6','Name7','Name8','Name9','Name10'};

nwalks=max(size(str));
hold off
nsteps=365;           % Number of Brownian steps
t=0:nsteps-1;
white=wgn(nsteps,nwalks,1);
%plot(t,white)             %white
brown=cumsum(white);
ymaxabs=10;
for i=1:nsteps
plot(t(1:i),brown(1:i,1:nwalks))      % brownian
ymaxcur=max([abs(brown(i,:)) sqrt(50*round(i/50)) 10]);
if (ymaxcur>ymaxabs)
    ymaxabs=ymaxcur;
end
axis ([0 nsteps -ymaxabs ymaxabs]);
%axis ('auto y');
for j=1:nwalks
text(t(i),brown(i,j),str(j),'FontSize',18)
end
F = getframe;
end

