LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
CanonicalFromPH2.m
1% [beta, B] = CanonicalFromPH2(alpha, A, prec)
2%
3% Returns the canonical form of an order-2 phase-type
4% distribution.
5%
6% Parameters
7% ----------
8% alpha : matrix, shape (1,2)
9% Initial vector of the phase-type distribution
10% A : matrix, shape (2,2)
11% Transient generator of the phase-type distribution
12% prec : double, optional
13% Numerical precision, default value is 1e-14
14%
15% Returns
16% -------
17% beta : matrix, shape (1,2)
18% The initial probability vector of the canonical form
19% B : matrix, shape (2,2)
20% Transient generator matrix of the canonical form
21%
22% Notes
23% -----
24% This procedure calculates 3 moments of the input and
25% calls 'PH2From3Moments'.
26
27function [beta, B] = CanonicalFromPH2 (alpha, A, prec)
28
29 if ~exist('prec','var')
30 prec = 1e-14;
31 end
32
33 global BuToolsCheckInput;
34 if isempty(BuToolsCheckInput)
35 BuToolsCheckInput = true;
36 end
37
38 if BuToolsCheckInput && ~CheckMERepresentation(alpha,A)
39 error('CanonicalFromPH2: Input isn''t a valid ME distribution!');
40 end
41
42 if size(A,1)~=2
43 error('CanonicalFromPH2: Dimension is not 2!');
44 end
45
46 [beta, B] = PH2From3Moments (MomentsFromME(alpha, A, 3), prec);
47end
48