How to use Poisson distribution?

4 views (last 30 days)
Jaya
Jaya on 1 Nov 2021
Commented: Jaya on 2 Nov 2021
Initially I was using poissrnd command to generate Poisson distributed numbers but I had no info on how to make them 'arrive' in my code. So I decided to generate the inter-arrival times. I do that as below.
t=exprnd(1/0.1);
for i=1:5
t=t+exprnd(1/0.1);
end
%t is like 31.3654 47.1014 72.0024 77.5162 102.3227 104.5794
%Even if this way of producing arrival times is wrong, still my question remains the same
All is ok to see but how can I actually use these times in my code to say that yes, arrival number 1 occuring at 31.3654 time, then arrival number 2 at 47.1014 time,etc. As ultimately I have to take an arrival, do some action, then receive another call. I cannot use a loop to increment through such varying numbers (even if i use ceil()).
So, what do people mean when they say they generated arrivals using Poisson distbn. How do they make use of the Posson distbn.? Because, the code won't know if a number is from Poisson or Rand distbn? I am tired of thinking an answer to this question. Please suggest something.

Accepted Answer

David Goodmanson
David Goodmanson on 2 Nov 2021
Hi Jaya,
You appear to be saying that you can't use a loop to increment through event times. For example, though, just before the loop you can construct
% make N events with mean wait time t0. For any fixed time interval, the
% number of events will obey a poisson distribution with lambda = 1/t0.
t0 = .2;
N = 1e5;
t = exprnd(t0,1,N);
mean(t) % should be close to t0
occurtimes = cumsum(t);
occurtimes(end) % should be close to N*t0
Then inside the loop, occurtimes(i) will give you the next event in running time.
If you have a poisson distribution for number of events in a time interval, then the exponential distribution is particular to the between-event wait time. Not, for example, a uniform distribution or anything else.
  1 Comment
Jaya
Jaya on 2 Nov 2021
Thanks for the answer! In fact, after posting this question I thought a lot and ultimately came to the same solution i.e. "Then inside the loop, occurtimes(i) will give you the next event in running time." So, your answer is a confirmation for me!

Sign in to comment.

More Answers (0)

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!