LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
LagkJointMomentsFromDMRAP.m
1% Nm = LagkJointMomentsFromDMRAP(H, K, L, prec)
2%
3% Returns the lag-L joint moments of a discrete marked
4% rational arrival process.
5%
6% Parameters
7% ----------
8% H : list/cell of matrices of shape(M,M), length(N)
9% The H0...HN matrices of the DMRAP to check
10% K : int, optional
11% The dimension of the matrix of joint moments to
12% compute. If K=0, the MxM joint moments will be
13% computed. The default value is 0
14% L : int, optional
15% The lag at which the joint moments are computed.
16% The default value is 1
17% prec : double, optional
18% Numerical precision to check if the input is valid.
19% The default value is 1e-14
20%
21% Returns
22% -------
23% Nm : list/cell of matrices of shape(K+1,K+1), length(L)
24% The matrices containing the lag-L joint moments,
25% starting from moment 0.
26
27function [Nm] = LagkJointMomentsFromDMRAP (h, K, L)
28
29 global BuToolsCheckInput;
30 if isempty(BuToolsCheckInput)
31 BuToolsCheckInput = true;
32 end
33
34 if BuToolsCheckInput && ~CheckDMRAPRepresentation(h)
35 error('LagkJointMomentsFromDMRAP: Input isn''t a valid DMRAP representation!');
36 end
37
38 M=size(h,2)-1;
39
40 if ~exist('K','var')
41 K=size(h{1},1)-1;
42 end
43
44 if ~exist('L','var')
45 L=1;
46 end
47
48 sumH = SumMatrixList(h(2:end));
49 iH0= inv(eye(size(h{1},1))-h{1});
50
51 pi = DRPSolve(iH0*sumH);
52 Pw = eye(size(h{1},1));
53 H0p = cell(K+1);
54 H0p{1} = Pw;
55 Pw = Pw * iH0;
56 H0p{2} = Pw;
57 for i=2:K
58 Pw = Pw*i*iH0*h{1};
59 H0p{i+1} = Pw;
60 end
61
62 Pl = (iH0*sumH)^(L-1);
63 Nm=cell(1,M);
64
65 for m=1:M
66 Nmm = zeros(K+1,K+1);
67 for i=1:K+1
68 for j=1:K+1
69 Nmm(i,j)=sum(pi*H0p{i}*iH0*h{m+1}*Pl*H0p{j});
70 end
71 end
72 row1 = MomsFromFactorialMoms(Nmm(1,2:end));
73 col1 = MomsFromFactorialMoms(Nmm(2:end,1));
74 mid = JMomsFromJFactorialMoms(Nmm(2:end,2:end));
75 Nm{m}= [Nmm(1,1), row1; col1, mid];
76 end
77
78end