Physics307L F09:People/Mondragon/Poisson/Notebook/20071227: Difference between revisions
From OpenWetWare
Jump to navigationJump to search
New page: # number of trials = numtrails # parameter lambda = lambda sample=poisson_rnd(lambda,50,numtrials); maxbin = max(max(sample)); minbin = min(min(sample)); fudge = minbin; bins=0:ma... |
(No difference)
|
Revision as of 20:21, 27 December 2007
# number of trials = numtrails
# parameter lambda = lambda
sample=poisson_rnd(lambda,50,numtrials);
maxbin = max(max(sample));
minbin = min(min(sample));
fudge = minbin;
bins=0:maxbins+fudge;
for i=1:50
histsample(i,:) = hist(sample(i,:),bins);
end
Running bar(bins,histsample(1,:)) would plot a histogram bar graph of the "data" collected in the first "trial." [histx, histy] = bar(bins,histsample(1,:)) generates vectors histx and histy so that plot(histx,histy) results in the same plot as bar(bins,histsample(1,:)). Having vectors histx and histy on hand might prove useful later.
for i=1:50
[histx(i,:), histy(i,:)] = bar(bins,histsample(i,:))
end