% m37_brownian.m - random walk (~ Brownian motion) of 1000 particles: % the "physics" of the heat equation. % Quit with ^C, and then try hist(x) or hist(y). hold off, shg N = 1000; x = zeros(N,1); y = zeros(N,1); dots = plot(x,y,'.k','markersize',10); axis(.6*[-1 1 -1 1]), axis square, axis off while 1 x = x + .005*randn(N,1); y = y + .005*randn(N,1); set(dots,'xdata',x,'ydata',y) drawnow end