somebody please help me with this code
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaire
Geoff Hayes
le 21 Mai 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?
Réponses (1)
Nagasai Bharat
le 24 Mai 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.
0 commentaires
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!