LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
map2.m
1function [ D0, D1, p ] = map2( H2lambda1, H2lambda2, H2p, decay)
2
3%Heindl: "INVERSE CHARACTERIZATION OF HYPEREXPONENTIAL MAP(2)S"
4
5% approximate the seperate arrival rates and probability
6% r1, r2, r3: first three moments
7r1 = H2p/H2lambda1 + (1-H2p)/H2lambda2;
8r2 = (2*H2p/(H2lambda1^2) + 2*(1-H2p)/(H2lambda2^2))/(factorial(2));
9r3 = (6*H2p/(H2lambda1^3) + 6*(1-H2p)/(H2lambda2^3))/(factorial(3));
10
11% the first moment should be same for all three distributions
12h2 = (r2-r1^2)/(r1^2);
13h3 = (r1*r3-r2^2)/(r1^4);
14a = h2;
15d = h3 + h2^2;
16b = d - a;
17c = b^2 + 4*a^3;
18
19if decay >= 0
20 lambda1 = 2*h2/(r1*(2*a+b-sqrt(c)));
21 lambda2 = 2*h2/(r1*(2*a+b+sqrt(c)));
22 p = 0.5 + b/(2*sqrt(c));
23 D0 = [-lambda1,0; 0,-lambda2];
24 D1 = (decay-1)*[-lambda1; -lambda2]*[p,1-p] - decay*D0;
25elseif decay < 0
26 x = (b+sqrt(c))/(2*a^2);
27 y = (-b+sqrt(c))/(2*a^2);
28 gamma1 = -x*(a^2*y+d)/(a*(y+1));
29 gamma2 = y*(a^2*x-d)/(a*(x-1));
30 if b >= 0
31 gamma3 = -y/x;
32
33 elseif b < 0
34 gamma3 = -x/y;
35
36 end
37 lower_bound = max(max(gamma1,gamma2),gamma3);
38 decay = ceil(lower_bound*10)/10;
39 fprintf('The smallest decay should be %0.2f, now decay is %0.2f \n', lower_bound, decay);
40
41 D0 = [-(2*a+b+sqrt(c)),0; 0,-(2*a+b-sqrt(c))]/(2*r1*h3);
42 D11 = (2*a+b+sqrt(c))*(1+b/sqrt(c)+decay*(1-b/sqrt(c)));
43 D12 = (2*a+b+sqrt(c))*(1-b/sqrt(c))*(1-decay);
44 D21 = (2*a+b-sqrt(c))*(1+b/sqrt(c))*(1-decay);
45 D22 = (2*a+b-sqrt(c))*(1-b/sqrt(c)+decay*(1+b/sqrt(c)));
46 D1 = [D11, D12; D21, D22]/(4*r1*h3);
47 p = x/(x+y);
48end
49end