LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
DPH2From3Moments.m
1% [alpha, A] = DPH2From3Moments(moms, prec)
2%
3% Returns an order-2 discrete phase-type distribution
4% which has the same 3 moments as given.
5%
6% Parameters
7% ----------
8% moms : vector of doubles, length(3)
9% The moments to match
10% prec : double, optional
11% Numerical precision, default value is 1e-14
12%
13% Returns
14% -------
15% alpha : matrix, shape (1,2)
16% The initial probability vector of the DPH(2)
17% A : matrix, shape (2,2)
18% Transition probability matrix of the DPH(2)
19%
20% Notes
21% -----
22% Raises an error if the moments are not feasible with
23% a DPH(2).
24%
25% This procedure first calls 'MGFromMoments', then transforms
26% it to DPH(2) by 'CanonicalFromDPH2'.
27
28function [alpha, A] = DPH2From3Moments (moms)
29
30 [beta, B] = MGFromMoments(moms(1:3));
31 [alpha,A] = CanonicalFromDPH2(beta,B);
32end