Question: Can you please help me to fix the MATLAB Code to fix the calculation of p _ state which is incorrect as it does not
Can you please help me to fix the MATLAB Code to fix the calculation of pstate which is incorrect as it does not computer all pstates which are in the queue and being served
The MMCQ Validation failed except cutil and the correct Ws value should be instead of as shown the out put below. Thanks
Define system parameters
lambda ; arrival rate
mu ; service rate
c ; number of servers
Nwait ; maximum number of customers in the queue
Call the MMCQ function with the given parameters
Ws Wq cutil, pdrop, pstate MMCQlambda mu c Nwait;
Run this test case to check your code
Ws Wq cutil, pdrop, pstate MMCQ;
Define a relative error function
relerror @xy absx yy;
Validate the results and print "PASS" or "FAIL" for each metric
if relerrorWs pstate
fprintfWs f PASS
Ws;
else
fprintfWs f FAIL
Ws;
end
if relerrorWs
fprintfWs f PASS
Ws;
else
fprintfWs f FAIL
Ws;
end
if relerrorWq
fprintfWqf PASS
Wq;
else
fprintfWq f FAIL
Wq;
end
if relerrorcutil,
fprintfcutil f PASS
cutil;
else
fprintfcutil f FAIL
cutil;
end
if relerrorpdrop,
fprintfpdrop f PASS
pdrop;
else
fprintfpdrop f FAIL
pdrop;
end
fprintfpstate s
numstrpstate;
Extra Tests
pstate should have Nwait probabilities
if relerrorsumpstate
dispThe probabilities sum to Test PASSED';
else
dispThe probabilities do not sum to Test FAILED.;
end
function Ws Wq cutil, pdrop, pstate MMCQlambda mu c Nwait
rho lambda c mu;
pdenom sumc rho:c factorial:c c rhoc factorialc rho;
p pdenom;
pstate zeros Nwait ;
pstate p;
for i :Nwait
ci mini c;
if i c
pstatei ci c pstatei rho factoriali;
else
pstatei cci factorialci pstatei rhoi factorialc;
end
end
pstate pstate sumpstate;
pN pstateNwait ;
pN pstateNwait;
lambdaloss lambda pN;
lambdaeff lambda lambdaloss;
Lq sum:Nwait pstate;
Ls Lq lambdaeff mu;
cbar Ls Lq;
cutil cbar c;
pdrop pN;
Ws Ls lambdaeff;
Wq Lq lambdaeff;
End
Ws FAIL
Wq FAIL
cutil PASS
pdrop FAIL
pstate ee
The probabilities sum to Test PASSED
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
