2 % 2-state Markov-Modulated Deterministic Process
4 % A specialized MMDP with exactly 2 phases,
using a convenient
5 % parameterization analogous to MMPP2.
8 % r0, r1: Deterministic rates in states 0 and 1
9 % sigma0: Transition rate from state 0 to state 1
10 % sigma1: Transition rate from state 1 to state 0
12 % The generator matrix
is:
13 % Q = [-sigma0, sigma0; sigma1, -sigma1]
18 % Copyright (c) 2012-2026, Imperial College London
19 % All rights reserved.
22 function self = MMDP2(r0, r1, sigma0, sigma1)
23 % MMDP2 Create a 2-state Markov-Modulated Deterministic Process
25 % @brief Creates a 2-state MMDP with specified rates and transitions
26 % @param r0 Deterministic rate in state 0
27 % @param r1 Deterministic rate in state 1
28 % @param sigma0 Transition rate from state 0 to state 1
29 % @param sigma1 Transition rate from state 1 to state 0
30 % @
return self MMDP2 instance
32 Q = [-sigma0, sigma0; sigma1, -sigma1];
37 % Override parameters with original scalar values
for convenience
38 self.params = cell(1, 4);
39 setParam(self, 1,
'r0', r0);
40 setParam(self, 2,
'r1', r1);
41 setParam(self, 3,
'sigma0', sigma0);
42 setParam(self, 4,
'sigma1', sigma1);
45 function rate = getMeanRate(self)
46 % GETMEANRATE Compute stationary mean rate (closed-form)
48 % For a 2-state MMDP, the mean rate has the closed form:
49 % E[r] = (r0*σ1 + r1*σ0) / (σ0 + σ1)
51 % @
return rate Stationary mean deterministic rate
53 r0 = self.getParam(1).paramValue;
54 r1 = self.getParam(2).paramValue;
55 sigma0 = self.getParam(3).paramValue;
56 sigma1 = self.getParam(4).paramValue;
57 rate = (r0*sigma1 + r1*sigma0) / (sigma0 + sigma1);
60 function scv = getSCV(self)
61 % GETSCV Compute squared coefficient of variation (closed-form)
63 % For a 2-state MMDP, the SCV has a closed form based on
64 % the variance of rates over the stationary distribution.
66 % @
return scv Squared coefficient of variation
68 r0 = self.getParam(1).paramValue;
69 r1 = self.getParam(2).paramValue;
70 sigma0 = self.getParam(3).paramValue;
71 sigma1 = self.getParam(4).paramValue;
73 % Stationary probabilities
74 pi0 = sigma1 / (sigma0 + sigma1);
75 pi1 = sigma0 / (sigma0 + sigma1);
78 mean_rate = pi0 * r0 + pi1 * r1;
79 var_rate = pi0 * r0^2 + pi1 * r1^2 - mean_rate^2;
82 scv = var_rate / (mean_rate^2);
88 function n = getNumberOfPhases(~)
89 % GETNUMBEROFPHASES Return the number of phases
91 % @
return n Always 2
for MMDP2
96 function Q_mat = Q(self)
97 % Q Return the generator matrix
99 % @
return Q_mat 2×2 generator matrix
101 sigma0 = self.getParam(3).paramValue;
102 sigma1 = self.getParam(4).paramValue;
103 Q_mat = [-sigma0, sigma0; sigma1, -sigma1];
106 function R_mat = R(self)
107 % R Return the rate matrix (diagonal)
109 % @
return R_mat 2×2 diagonal rate matrix
111 r0 = self.getParam(1).paramValue;
112 r1 = self.getParam(2).paramValue;
113 R_mat = diag([r0; r1]);
116 function r_vec = r(self)
117 % r Return the rate vector
119 % @
return r_vec 2-vector of rates [r0; r1]
121 r0 = self.getParam(1).paramValue;
122 r1 = self.getParam(2).paramValue;