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