1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 nsam = 1001; rand("seed", 0) p = rand(nsam,1); tau = -log(p); time = [0; cumsum(tau)]; Y = 0:nsam; figure() [xx,yy] = stairs(time, Y); xx(end) = []; yy(end) = []; figure() nbins = 20; hist(tau,20) [ntau, tausam] = hist(tau, nbins); [tausamb, ntaub] = obar(tausam, ntau); table1 = [xx,yy]; table2 = [tausamb, ntaub]; save poissonlots.dat table1 table2