Physics307L F09:People/Mondragon/Poisson/Notebook/20090513

Ok, for better results, I switched to using a 4000 by 4000 matrix to simulate the first counting experiment.

The first matrix table1_3 represents 4000 trails of 4000 counting experiments were the average number of counts in each counting experiment (or whatever the $$\lambda$$ in $$f(k; \lambda)=\frac{\lambda^k e^{-\lambda}}{k!},\,\!$$ means) is 1.3 ($$\lambda = 1.3$$). Each row is a a trail run. If the entry on row $$r$$ and column $$c$$ is $$x$$, then counting experiment $$c$$ in trail run $$r$$ had a count of $$x$$ events.

The rows of histy are the histograms of each corresponding trail run. I ran the bins for this one out to 50, since even at $$\lambda = 9$$, the max count in the 4000 by 4000 matrix above should be around 26 or so. Rows represent the test run, columns represent how many times a count of $$column number - 1$$ happened in that trail run. histy should be 4000 by 51. If the entry on row $$r$$ and column $$c$$ is $$x$$, then there was $$x$$ occurrences of a count of $$c - 1$$ in trail run $$r$$.

The rows of histyy are histograms of the results in histy. If the entry on row $$r$$ and column $$c$$ is $$x$$, then there was $$x$$ trail runs were a count of $$r- 1$$ happened $$c-1$$ times.

it is histyy that I am really interested in. It should show what trends values in a Poisson plots tend to take. As I thought, values near $$\lambda$$ have a Gaussian spread and values far from $$\lambda$$ have a Poisson spread.

diary
octave:2> diary on octave:3> load table1_3.asc octave:4> who


 * dynamically linked functions:

builtin:find builtin:max   builtin:min   dispatch


 * currently compiled functions:

findstr  ispc      pkg       split     strrep fullfile isscalar  repmat    strcat


 * local user variables:

__nargin__ table1_3

octave:5> maxbin = max(max(table1_3)) maxbin = 10 octave:6> minbin = min(min(table1_3)) minbin = 0 octave:7> t=poissrnd(5,50,50); octave:8> max(max(t)) ans = 15 octave:9> t=poissrnd(5,50,50); octave:10> max(max(t)) ans = 14 octave:11> t=poissrnd(9,50,50); octave:12> max(max(t)) ans = 20 octave:13> t=poissrnd(9,50,50); octave:14> max(max(t)) ans = 19 octave:15> t=poissrnd(9,50,50); octave:16> max(max(t)) ans = 23 octave:17> t=poissrnd(10,50,50); octave:18> max(max(t)) ans = 24 octave:19> t=poissrnd(10,50,50); octave:20> max(max(t)) ans = 22 octave:21> t=poissrnd(10,50,50); octave:22> max(max(t)) ans = 22 octave:23> t=poissrnd(10,50,50); octave:24> max(max(t)) ans = 24 octave:25> t=poissrnd(10,50,50); octave:26> max(max(t)) ans = 25 octave:27> t=poissrnd(10,50,50); octave:28> max(max(t)) ans = 22 octave:29> ok, 30 error: `ok' undefined near line 29 column 1 octave:29> bins=0:30; octave:30> for i=1:500 > [histx(i,:), histy(i,:)] = hist(table1_3),bins); parse error:

syntax error

>>> [histx(i,:), histy(i,:)] = hist(table1_3),bins);                                                  ^

octave:30> for i=1:500 > [histx(i,:), histy(i,:)] = hist(table1_3),bins)); parse error:

syntax error

>>> [histx(i,:), histy(i,:)] = hist(table1_3),bins)); ^

octave:30> [histx(i,:), histy(i,:)] = hist((table1_3),bins); error: number of columns must match (1 != 1500) error: evaluating argument list element number 1 error: evaluating if command near line 100, column 3 error: called from `hist' in file `/usr/share/octave/3.0.0/m/plot/hist.m' octave:30> for i=1:500 > [histx(i,:), histy(i,:)] = hist((table1_3),bins); > end error: number of columns must match (1 != 1500) error: evaluating argument list element number 1 error: evaluating if command near line 100, column 3 error: called from `hist' in file `/usr/share/octave/3.0.0/m/plot/hist.m' error: evaluating for command near line 30, column 1 octave:30> for i=1:500 > [histx(i,:), histy(i,:)] = hist((table1_3(i,:)),bins); > end octave:31> plot usage: plot (y) plot (x, y, ...) plot (x, y, fmt, ...)      plot (x, y, property, value, ...) error: evaluating if command near line 28, column 3 error: called from `__plt__' in file `/usr/share/octave/3.0.0/m/plot/__plt__.m' error: evaluating assignment expression near line 187, column 9 error: called from `plot' in file `/usr/share/octave/3.0.0/m/plot/plot.m' octave:31> plot(histx(1,:),histy(2,:)) octave:32> bar(histx(1,:), histy(1,:)) error: bar: x vector values must be in ascending order error: evaluating if command near line 108, column 3 error: called from `__bar__' in file `/usr/share/octave/3.0.0/m/plot/__bar__.m' error: called from `bar' in file `/usr/share/octave/3.0.0/m/plot/bar.m' octave:32> bar( histy(1,:)) octave:33> histy histy =

octave:34> bar( histx(1,:)) octave:35> bar( histx(51,:)) octave:36> for 1:500 parse error:

syntax error

>>> for 1:500 ^

octave:36> for i=1:500 > bar( histx(i,:)) > end octave:37> histx(64,:) ans =

Columns 1 through 13:

390  553   332   159    52    12     2     0     0     0     0     0     0

Columns 14 through 26:

0    0     0     0     0     0     0     0     0     0     0     0     0

Columns 27 through 31:

0    0     0     0     0

octave:38> histx(:,1) ans =

octave:39> bar(histx(:,1)) octave:40> ooooooo that looks like its possibly gaussian, just as I thought it would parse error:

syntax error

>>> ooooooo that looks like its possibly gaussian, just as I thought it would ^

octave:40> max(histx(:,1)) ans = 462 octave:41> min(histx(:,1)) ans = 351 octave:42> hist(histx(:,1), 351:462) octave:43> size(table1_3) ans =

1500  1500

octave:44> oops error: `oops' undefined near line 44 column 1 octave:44> for i=1:1500 > histy(i,:) = hist((table1_3(i,:)),bins); > end octave:45> max(histy(:,1)) ans = 470 octave:46> min(histy(:,1)) ans = 341 octave:47> hist(histy(:,1), 341:470) octave:48> table1_3 = poissrnd(1.3,4000,4000); octave:49> for i=1:4000 > end octave:50> maxbin = max(max(table1_3)) maxbin = 10 octave:51> minbin = min(min(table1_3)) minbin = 0 octave:52> bins = 0:50; octave:53> for i=1:4000 > histy(i,:) = hist((table1_3(i,:)),bins); > end error: A(IDX-LIST) = X: X must be a scalar or size of X must equal number of elements indexed by IDX-LIST error: assignment failed, or no method for `matrix = matrix' error: evaluating assignment expression near line 54, column 12 error: evaluating for command near line 53, column 1 octave:53> histy(56,:) = hist((table1_3(56,:)),bins); error: A(IDX-LIST) = X: X must be a scalar or size of X must equal number of elements indexed by IDX-LIST error: assignment failed, or no method for `matrix = matrix' error: evaluating assignment expression near line 53, column 13 octave:53> table1_3 = poissrnd(1.3,3000,3000); octave:54> histy(56,:) = hist((table1_3(56,:)),bins); error: A(IDX-LIST) = X: X must be a scalar or size of X must equal number of elements indexed by IDX-LIST error: assignment failed, or no method for `matrix = matrix' error: evaluating assignment expression near line 54, column 13 octave:54> bins bins =

Columns 1 through 20:

0  1   2   3   4   5   6   7   8   9  10  11  12  13  14  15  16  17  18  19

Columns 21 through 40:

20 21  22  23  24  25  26  27  28  29  30  31  32  33  34  35  36  37  38  39

Columns 41 through 51:

40 41  42  43  44  45  46  47  48  49  50

octave:55> histy(56,:) = hist((table1_3(56,:),bins); parse error:

syntax error

>>> histy(56,:) = hist((table1_3(56,:),bins);                                     ^

octave:55> histy(56,:) = hist(table1_3(56,:),bins); error: A(IDX-LIST) = X: X must be a scalar or size of X must equal number of elements indexed by IDX-LIST error: assignment failed, or no method for `matrix = matrix' error: evaluating assignment expression near line 55, column 13 octave:55> histy(56,:) = hist(table1_3(56,:)); error: A(IDX-LIST) = X: X must be a scalar or size of X must equal number of elements indexed by IDX-LIST error: assignment failed, or no method for `matrix = matrix' error: evaluating assignment expression near line 55, column 13 octave:55> table1_3(56,:) ans =

octave:56> size(table1_3) ans =

3000  3000

octave:57> is 3000 by 3000 just too big? parse error:

syntax error

>>> is 3000 by 3000 just too big? ^

octave:57> table1_3 = poissrnd(1.3,2000,2000); octave:58> histy(56,:) = hist(table1_3(56,:)); error: A(IDX-LIST) = X: X must be a scalar or size of X must equal number of elements indexed by IDX-LIST error: assignment failed, or no method for `matrix = matrix' error: evaluating assignment expression near line 58, column 13 octave:58> table1_3 = poissrnd(1.3,1500,1500); octave:59> histy(56,:) = hist(table1_3(56,:)); error: A(IDX-LIST) = X: X must be a scalar or size of X must equal number of elements indexed by IDX-LIST error: assignment failed, or no method for `matrix = matrix' error: evaluating assignment expression near line 59, column 13 octave:59> histy(56) = hist(table1_3(56,:)); error: A(I) = X: X must be a scalar or a matrix with the same size as I error: assignment failed, or no method for `matrix = matrix' error: evaluating assignment expression near line 59, column 11 octave:59> hist(table1_3(56,:)); octave:60> ans ans =

3000  3000

octave:61> x=hist(table1_3(56,:)); octave:62> x x =

451  516   320   151    46     0    13     2     0     1

octave:63> x(56)=hist(table1_3(56,:)); error: A(I) = X: X must be a scalar or a vector with same length as I error: assignment failed, or no method for `matrix = matrix' error: evaluating assignment expression near line 63, column 6 octave:63> x(56,:)=hist(table1_3(56,:)); octave:64> histy(56,:)=hist(table1_3(56,:)); error: A(IDX-LIST) = X: X must be a scalar or size of X must equal number of elements indexed by IDX-LIST error: assignment failed, or no method for `matrix = matrix' error: evaluating assignment expression near line 64, column 12 octave:64> clear all octave:65> clear -all octave:66> who


 * dynamically linked functions:

dispatch


 * currently compiled functions:

pkg


 * local user variables:

__nargin__

octave:67> table1_3 = poissrnd(1.3,4000,4000); octave:68> x(56,:)=hist(table1_3(56,:)); octave:69> histy(56,:)=hist(table1_3(56,:)); octave:70> memory was cluttered? parse error:

syntax error

>>> memory was cluttered? ^

octave:70> clear all octave:71> table1_3 = poissrnd(1.3,4000,4000); octave:72> for i=1:4000 > histy(i,:)=hist(table1_3(i,:),0:50); > end octave:73> bins = 0:50; octave:74> save -text table1_3.asc table1_3 histy bins octave:75> min(histy(:,1)) ans = 993 octave:76> max(histy(:,1)) ans = 1186 octave:77> hist(histy(:,1),993:1186) octave:78> max(max(histy)) ans = 1527 octave:79> min(min(histy)) ans = 0 octave:80> size(histy) ans =

4000    51

octave:81> for i = bins > histyy(i,:)=hist(histy(:,i),0:2000); > end error: invalid column index = 0 error: evaluating argument list element number 1 error: evaluating assignment expression near line 82, column 12 error: evaluating for command near line 81, column 1 octave:81> for i = bins+1 > histyy(i,:)=hist(histy(:,i),0:2000); > end octave:82> bar(histyy(1,:),0:2000) error: bar: x vector values must be in ascending order error: evaluating if command near line 108, column 3 error: called from `__bar__' in file `/usr/share/octave/3.0.0/m/plot/__bar__.m' error: called from `bar' in file `/usr/share/octave/3.0.0/m/plot/bar.m' octave:82> bar(0:2000,histyy(1,:)) octave:83> bar(0:2000,histyy(2,:)) octave:84> bar(0:2000,histyy(3,:)) octave:85> bar(0:2000,histyy(9,:)) octave:86> axis([0,10]) octave:87> bar(0:2000,histyy(7,:)) octave:88> axis([0,10]) octave:89> axis([0,30]) octave:90> save -text table1_3.asc table1_3 histy bins histyy octave:91> clear histyy octave:92> who


 * dynamically linked functions:

builtin:find   builtin:min     gnuplot_binary  regexp builtin:kron   cellfun         issparse        sort builtin:max    dispatch        randp


 * currently compiled functions:

__bar__              diff                  lower __bars__             drawnow               newplot __gnuplot_version__  findstr               patch __go_draw_axes__     gca                   pkg __go_draw_figure__   gcf                   poissrnd __next_line_color__  hist                  rem __patch__            image_viewer          repmat __plt_get_axis_arg__ isa                   split ancestor             ismember              str2num axes                 isscalar              strcat axis                 isstr                 strcmpi bar                  isvector              xor compare_versions     logical


 * local user variables:

__nargin__ ans         bins        histy       i           table1_3

octave:93> bins2 = 0:2500; octave:94> for i = bins+1 > histyy(i,:)=hist(histy(:,i),bars2); > end error: `bars2' undefined near line 95 column 29 error: evaluating argument list element number 2 error: evaluating assignment expression near line 95, column 12 error: evaluating for command near line 94, column 1 octave:94> for i = bins+1 > histyy(i,:)=hist(histy(:,i),bins2); > end octave:95> save -text table1_3.asc table1_3 histy bins histyy bins2 octave:96> size(histyy) ans =

51  2501

octave:97> [xx,yy]=meshgrid(bins, bins2); octave:98> mesh(xx,yy,histyy) error: surface: x, y, and z must have same dimensions error: evaluating if command near line 114, column 7 error: evaluating if command near line 106, column 5 error: evaluating if command near line 76, column 3 error: called from `surface:__surface__' in file `/usr/share/octave/3.0.0/m/plot/surface.m' error: called from `surface' in file `/usr/share/octave/3.0.0/m/plot/surface.m' error: evaluating assignment expression near line 37, column 7 error: called from `mesh' in file `/usr/share/octave/3.0.0/m/plot/mesh.m' octave:98> [xx,yy]=meshgrid(bins2, bins); octave:99> size(xx) ans =

51  2501

octave:100> mesh(xx,yy,histyy) octave:101> octave:101> diary off

important excerpts
octave:71> table1_3 = poissrnd(1.3,4000,4000); octave:72> for i=1:4000 > histy(i,:)=hist(table1_3(i,:),0:50); > end octave:73> bins = 0:50; octave:93> bins2 = 0:2500; octave:94> for i = bins+1 > histyy(i,:)=hist(histy(:,i),bins2); > end