LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
MG1_G_ETAQA.m
1function G = MG1_G_ETAQA(An)
2% MG1_G_ETAQA computes the G matrix for M/G/1-Type Markov Chains [Bini, Meini]
3%
4%
5% Discrete case:
6% G = MG1_G_ETAQA(An) computes the minimal nonnegative solution to the
7% matrix equation G = A0 + A1 G + A2 G^2 + A3 G^3 + ... + A_max G^max,
8% a nonnegative matrix, with (A0+A1+A2+...+A_max) irreducible and
9% stochastic
10%
11% Continuous case:
12% G = MG1_G_ETAQA(An) computes the minimal nonnegative solution to the
13% matrix equation 0 = A0 + A1 G + A2 G^2 + A3 G^3 + ... + A_max G^max,
14% a nonnegative matrix, with (A0+A1+A2+...+A_max) irreducible and
15% stochastic
16
17r = size(An,1);
18s = size(An,2);
19b = s/r;
20psize = r;
21Gtemp = zeros(psize,psize);
22
23
24% check if the matrix is stochastic
25
26rowsum = sum(An,2);
27isdiscrete = 0;
28for i=1:r
29 if (rowsum(i) < 1e-16)
30
31 else
32 isdicrete = 1;
33 end
34end
35
36if (isdiscrete == 0)
37 L = An(:,r+1:2*r);
38 t = min(diag(L));
39 if (t > 0)
40 error('This is not stochastic matrix, neither continuous nor discrete! \n Please make sure every row sum up to 0 or 1');
41 end
42 An = An/(-t);
43 An(:,r+1:2*r) = An(:,r+1:2*r) + eye(r);
44
45end
46
47
48G = MG1_CR(An);
49
50
51%while max(max(abs(G-Gtemp))) > 1e-15
52% Gtemp = G;
53% G = zeros(psize,psize);
54% E=eye(psize);
55% for i = 1:s
56% G = G + An{i}*E;
57% E=E*Gtemp;
58% end
59%end
60
61
62
63
64end