LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
MomentsFromDPH.m
1% moms = MomentsFromDPH(alpha, A, K, prec)
2%
3% Returns the first K moments of a discrete phase-type
4% distribution.
5%
6% Parameters
7% ----------
8% alpha : vector, shape (1,M)
9% The initial probability vector of the discrete phase-
10% type distribution. The sum of the entries of pi0 is
11% less or equal to 1.
12% A : matrix, shape (M,M)
13% The transient generator matrix of the discrete phase-
14% type distribution.
15% K : int, optional
16% Number of moments to compute. If K=0, 2*M-1 moments
17% are computed. The default value is 0.
18% prec : double, optional
19% Numerical precision for checking the input.
20% The default value is 1e-14.
21%
22% Returns
23% -------
24% moms : row vector of doubles
25% The vector of moments.
26%
27
28function moms = MomentsFromDPH (alpha, A, K)
29
30 global BuToolsCheckInput;
31 if isempty(BuToolsCheckInput)
32 BuToolsCheckInput = true;
33 end
34
35 if BuToolsCheckInput && ~CheckDPHRepresentation(alpha, A)
36 error('MomentsFromDPH: Input isn''t a valid PH representation!');
37 end
38
39 if ~exist('K','var')
40 K = 0;
41 end
42
43 moms = MomentsFromMG (alpha, A, K);
44end
45