1function MAPH = maph2m_fit(M1, M2, M3,
P, B)
2% Computes the second-order MAPH[m] fitting the given ordinary moments
3% (of order up to three), the
class probabilities (always fitted exactly)
4% and the backward moments,
7% - M1,M2,M3: moments of the inter-arrival times
8% -
P:
class probabilities
9% - B: first-order backward moments
11% - MAPH: fitted second-order MAPH[m]
17% fit underlying AMAP(2)
18[~,APHS] = aph2_fit(M1, M2, M3);
20% fit the MAMAP(2,m) using the underlying AMAP(2) form which produces the
22MAPHS = cell(1,length(APHS));
23ERRORS = zeros(1,length(APHS));
25 [MAPHS{j},fB] = maph2m_fit_multiclass(APHS{j}, P, B);
26 ERRORS(j) = sum((fB./B - 1).^2);
28[~,BEST] = min(ERRORS);