LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
PmfFromMG.m
1% pmf = PmfFromMG(alpha, A, x, prec)
2%
3% Returns the probability mass function of a matrix-
4% geometric distribution.
5%
6% Parameters
7% ----------
8% alpha : vector, shape (1,M)
9% The initial vector of the matrix-geometric
10% distribution. The sum of the entries of pi0 is less
11% or equal to 1.
12% A : matrix, shape (M,M)
13% The matrix parameter of the matrix-geometric
14% distribution.
15% x : vector of non-negative integers
16% The density function will be computed at these points
17% prec : double, optional
18% Numerical precision to check if the input MG
19% distribution is valid. The default value is 1e-14.
20%
21% Returns
22% -------
23% pmf : column vector of doubles
24% The probabilities that the matrix-geometrically
25% distributed random variable takes the corresponding "x"
26% values
27%
28
29function pmf = PmfFromMG (alpha, A, x)
30
31 global BuToolsCheckInput;
32 if isempty(BuToolsCheckInput)
33 BuToolsCheckInput = true;
34 end
35
36 if BuToolsCheckInput && ~CheckMGRepresentation(alpha, A)
37 error('PmfFromMG: Input isn''t a valid MG distribution!');
38 end
39
40 a = 1.0 - sum(A,2);
41 pmf = zeros(1,length(x));
42 for i=1:length(x)
43 if x(i)==0
44 pmf(i) = 1.0 - sum(alpha);
45 else
46 pmf(i) = sum(alpha*(A^(x(i)-1))*a);
47 end
48 end
49end