Simulation virtual waiting time / workload process of a M/G/1 queue

2 views (last 30 days)
Hi folks,
I'm trying to simulate the workload process of a M/G/1 queue. The inter arrival times are exponential and the jumps are according to a general distribution, e.g. also exponential. I tried to build such a workload process, but the output is completely wrong. Maybe someone can help me with this problem ? It should be looks like the process in the included graphic. Thanks a lot!
My first code is the following (it should be iterative) :
function y=mg1(t) lambda1=1.6; lambda2=5; arrtime=exprnd(lambda1,6,1); sumarrtime=cumsum(arrtime); n=length(arrtime); jumps=exprnd(lambda2,6,1); t=0:0.01:30; x=5;
y1=(x-t).*(t<sumarrtime(1)); y2=(subplus((y1+jumps(1))-t)).*(sumarrtime(1)<=t<sumarrtime(2)); y3=(subplus((y2+jumps(2))-t)).*(sumarrtime(2)<=t<sumarrtime(3)); y=y1+y2+y3;
plot(t,subplus(y));

Answers (0)

Categories

Find more on Embedded Coder in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!