Effacer les filtres
Effacer les filtres

Small store parking Stochastic Process

3 vues (au cours des 30 derniers jours)
Kevin Nieto
Kevin Nieto le 12 Fév 2019
Commenté : Walter Roberson le 12 Fév 2019
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.
  1. What percentage of customers is lost by not having any space available?
  2. What is the probability of finding an available spot in the parking lot?
  3. 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 commentaires
Kevin Nieto
Kevin Nieto le 12 Fév 2019
Hello, I have the code but it is incomplete, so I would like to get help on how to complete it. Im new to matlab and I copied that from the professor's code. But I was not able to copy it all. Thank you
Walter Roberson
Walter Roberson le 12 Fév 2019
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 .

Connectez-vous pour commenter.

Réponses (0)

Produits


Version

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by