In Matlab, I want generate events that follow Poisson arrivals and the inter-arrival time between events to be exponentially distributed?
Which command should I use ?
In Matlab, I want generate events that follow Poisson arrivals and the inter-arrival time between events to be exponentially distributed?
Which command should I use ?
Suppose you have a counting process, {N(t),t >= 0}, where N(t) is the number of events to occur by t.
If these events follow a Poisson Process (PP) with rate lambda then there are a host of properties we get for free. This posts assumes a homogeneous (or stationary) PP. See here and here and here for the time-dependent case.
Interevent times from a PP are Exponentially distributed with rate lambda.
Approach 1:
1. Generate interevent times
2. Obtain actual event times <---what you're wanting
Rate = 0.75; % lambda (events per unit time)
NumEvents = 20; % number of events to generate
% Approach 1a requires exprnd function
InterEventTimes = exprnd(1/Rate,NumEvents,1);
EventTimes = cumsum(InterEventTimes);
% Approach 1b using inverse transform of exponential distribution
fh =@(n) - log(rand(n,1) / Rate; % inverse transform of exponential distribution
InterEventTimes2 = fh(NumEvents);
EventTimes2 = cumsum(InterEventTimes2);
Validation for both of these approaches is available here.
I am not sure whether there is a function, or that I am understanding the question correctly.
The formula for event times of a Poisson process is
tau=1/lambda*ln(1/r)
where lambda
is the intensity of the process and r
is a unit uniform distribution, such as the one produced by rand
.