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

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));

답변 (0개)

카테고리

도움말 센터File Exchange에서 Embedded Coder에 대해 자세히 알아보기

질문:

2013년 12월 20일

Community Treasure Hunt

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

Start Hunting!

Translated by