How to use Poisson distribution?
9 次查看(过去 30 天)
显示 更早的评论
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.
0 个评论
采纳的回答
David Goodmanson
2021-11-2
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.
更多回答(0 个)
另请参阅
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!