Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I am geting error message Array indices must be positive integers or logical values. MMCQ ( line 9 4 4 ) pN = p

I am geting error message " Array indices must be positive integers or logical values.
MMCQ (line 944)
pN = p_state(Nwait +1);. How can I correct it to show that Nwait includes all callers in the queue and being served as well % The following code is to aid in solving the decision tree problem.
function [A,B, idMap]= ArrangeMatrix(P)
% Partitions the matrix P in the following form
% P =| A B |
%|0 I |
% by re-arranging the matrix P to put all the absorbing states in the bottom right corner.
% INPUTS:
% P = Markov chain matrix
% OUTPUTS:
% A = Matrix
% B = Matrix
% idMap = Mapping of old state # to new state #
Pstar = P;
toRowCol = length(P); % Where to put the next absorp state
stateID =1:toRowCol;
% Determine if there are any absorbing states
[nrows,ncols]= find(Pstar ==1);
while (~isempty(nrows))
% Get the state to move
nrow = nrows(1);
ncol = ncols(1);
% Swap Row
tempcol = Pstar(ncol,:);
Pstar(ncol,:)= Pstar(toRowCol,:);
Pstar(toRowCol,:)= tempcol;
% Swap column
temprow = Pstar(:,nrow);
Pstar(:,nrow)= Pstar(:,toRowCol);
Pstar(:,toRowCol)= temprow;
% Swap the state IDs
temp = stateID(toRowCol);
stateID(toRowCol)= stateID(nrow);
stateID(nrow)= temp;
% Decrement row/column destination
toRowCol = toRowCol -1;
% Find the next one to move
[nrows,ncols]= find(Pstar(1:toRowCol,1:toRowCol)==1);
end
% Get the sub-matries
A = Pstar(1:toRowCol,1:toRowCol);
B = Pstar(1:toRowCol,toRowCol+1:end);
idMap = stateID;
end
% Define the erlang function
function B = erlangb(N, A)
if (length(N)~=1)|(fix(N) ~= N)|(N <0)
error('N must be a scalar positive integer');
end
% TODO: test that elements of A are real and positive here?
esum = zeros(size(A));
for ii=0:N
esum = esum + A .^ ii ./ factorial(ii);
end
B = A .^ N ./(factorial(N).* esum);
end

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction to Wireless and Mobile Systems

Authors: Dharma P. Agrawal, Qing An Zeng

4th edition

1305087135, 978-1305087132, 9781305259621, 1305259629, 9781305537910 , 978-130508713

More Books

Students also viewed these Programming questions