somebody please help me with this code

3 visualizaciones (últimos 30 días)
지우 김
지우 김 el 20 de Mayo de 2021
Respondida: Nagasai Bharat el 24 de Mayo de 2021
function s=poissonarrivals(lam,T)
%arrival times s=[s(1) ... s(n)]
% s(n)<= T < s(n+1)
n=ceil(1.1*lam*T);
s=cumsum(exponentialrv(lam,n));
while (s(length(s))< T),
s_new=s(length(s))+ ...
cumsum(exponentialrv(lam,n));
s=[s; s_new];
end
s=s(s<=T);
function N=poissonprocess(lambda,t)
%N(i) = no. of arrivals by t(i)
s=poissonarrivals(lambda,max(t));
N=count(s,t);
hi trying to understand how this code works but have no clue... its a solution for the question below
Generate a sample path of N(t), a rate = 5 arrivals/min Poisson process. Plot N(t)
over a 10-minute interval.
i really dont understand how this works and like there are commands like exponentialrv which i cant find
  1 comentario
Geoff Hayes
Geoff Hayes el 21 de Mayo de 2021
Where did you get the above code? Is it something that you have written or are expected to write as part of the homework? The code from https://www.mathworks.com/matlabcentral/answers/444462-small-store-parking-stochastic-process is similar to what you have above - is that where you copied it from?

Iniciar sesión para comentar.

Respuestas (1)

Nagasai Bharat
Nagasai Bharat el 24 de Mayo de 2021
Hi,
From my understanding you are trying to generate a Poisson process with a given interval and arrival rate. To do that the following documentation would help you.
From the above code, the exponentialrv looks like a user defined function and is not a MATLAB command or function as per this.

Community Treasure Hunt

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

Start Hunting!

Translated by