npts = 1000; nplot = 10; seed = 1; for i = 1:nplot xplot = []; x = 0; for j=1:npts seed = rem(8121 * seed + 28411, 134456); if (seed > (134456/2)) x = x + 1; else x = x - 1; end xplot = [xplot x]; end plot(xplot,'g') hold on end t = 1:(npts/10):npts; error = sqrt(t)*1.5; errorbar(t,zeros(size(t)),error,error,'.') xlabel('t') ylabel('x') axis([0 npts -2*sqrt(npts) 2*sqrt(npts)]) hold off print -deps plot.eps