somebody please help me with this code
조회 수: 1 (최근 30일)
이전 댓글 표시
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
Geoff Hayes
2021년 5월 21일
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?
답변 (1개)
Nagasai Bharat
2021년 5월 24일
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
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!