Small store parking Stochastic Process
조회 수: 3 (최근 30일)
이전 댓글 표시
I have to make a simulation of one year to find the answers.
A small store has a parking lot with six available spots. Customers arrive randomly according to a Poisson process at a mean rate of ten customers per hour, and leave immediately if there is no place to park. The time a car remains in the parking lot follows a uniform distribution between ten and thirty minutes.
- What percentage of customers is lost by not having any space available?
- What is the probability of finding an available spot in the parking lot?
- What is the average percentage of available spaces?
I already have 3 functions. I attach them below. Thanks in advance
%1st function
function s=poissonarrivals(lambda,T)
n=ceil(1.1*lambda*T);
s=cumsum(exponentialrv(lambda,n));
while (s(length(s))<T),
s_new=s(lenght(s))+...
cumsum(exponpoisentialrv(lambda,n));
s=[s;s_new];
end
s=s(s<=T);
%2nd function
function x=exponentialrv(lambda,m)
x=-(1/lambda)*log(1-rand(m,1));
%3rd function THIS IS THE ONE I NEED TO COMPLETE BUT I DONT KNOW HOW
t=0.1*(0:2400);
lambda=0.1666;
s=poissonarrivals(lambda,max(t));
stem(s);
xlabel('Numero de arribos');
ylabel('Tiempo de llegada');
l=length(s);
p=20*rand(1,l)*10;
%for j=1:365
for m=1:length(s)
if wt(m)<s(i)
wt(m)=s(i)+p(i);
flag=1;
else
m=m+1;
end
end
if m<6
tem=tem+1;
end
%end
pe=tem/length(s)
c=(1-pe)*100
댓글 수: 3
Walter Roberson
2019년 2월 12일
ok but you still did not ask a question . We can answer specific questions like what error messages mean or what the name is of a matlab routine to do a particular thing . We are not likely to bother reading through uncommented code and comparing it to the assignment requirements and telling you what is missing and how to write that .
답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!