Poisson random numbers
x = distfun_poissrnd(lambda) x = distfun_poissrnd(lambda,[m,n]) x = distfun_poissrnd(lambda,m,n)
a matrix of doubles, the average rate of occurrence. lambda>0.
a 1-by-1 matrix of floating point integers, the number of rows of x
a 1-by-1 matrix of floating point integers, the number of columns of x
a matrix of doubles, the random numbers in the set {0,1,2,3,...}.
Generates random variables from the Poisson distribution function.
Any scalar input argument is expanded to a matrix of doubles of the same size as the other input arguments.
// Test with expanded lambda x = distfun_poissrnd(1:6) // Check expansion of lambda in x = distfun_poissrnd(lambda) x = distfun_poissrnd([12 14 20]) // Check x = distfun_poissrnd(lambda,v) x = distfun_poissrnd(2,[4 5]) // Check mean and variance N = 50000; lambda = 13; x = distfun_poissrnd(lambda,[1 N]); Mx = mean(x) Vx = variance(x) [M,V] = distfun_poissstat (lambda) // Check actual distribution lambda=12; N=10000; h=scf(); x=distfun_poissrnd(lambda,1,N); distfun_inthisto(x); h.children.children(1).children.background=-2; x=0:2*lambda; y=distfun_poisspdf(x,lambda); plot(x,y,"ro-"); xtitle("Poisson Random Numbers","X","Frequency") legend(["Empirical","Density"]); | ![]() | ![]() |
http://en.wikipedia.org/wiki/Poisson_distribution