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