LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
RAPFromMomentsAndCorrelations.m
1% [H0, H1] = RAPFromMomentsAndCorrelations(moms, corr)
2%
3% Returns a rational arrival process that has the same moments
4% and lag autocorrelation coefficients as given.
5%
6% Parameters
7% ----------
8% moms : vector of doubles
9% The vector of marginal moments. To obtain a RAP of
10% size M, 2*M-1 moments are required.
11% corr : vector of doubles
12% The vector of lag autocorrelation coefficients. To
13% obtain a RAP of size M, 2*M-3 coefficients are needed.
14%
15% Returns
16% -------
17% H0 : matrix, shape (M,M)
18% The H0 matrix of the rational arrival process
19% H1 : matrix, shape (M,M)
20% The H1 matrix of the rational arrival process
21%
22% Notes
23% -----
24% There is no guarantee that the returned matrices define
25% a valid stochastic process. The joint densities may be
26% negative.
27%
28% References
29% ----------
30% .. [1] Mitchell, Kenneth, and Appie van de Liefvoort.
31% "Approximation models of feed-forward G/G/1/N
32% queueing networks with correlated arrivals."
33% Performance Evaluation 51.2 (2003): 137-152.
34
35function [D0,D1] = RAPFromMomentsAndCorrelations (moms, corr)
36
37 [alpha, D0] = MEFromMoments (moms);
38 M = length(alpha);
39
40 if length(corr) < 2*M-3
41 error('RAPFromMomentsAndCorrelations: The number of correlations given is less than required the 2n-3!');
42 end
43
44 rcorr=corr(1:2*M-3)/((moms(2)/2-moms(1)^2)/(moms(2)-moms(1)^2));
45 rcorr = MomsFromReducedMoms (rcorr);
46 [~,X] = MEFromMoments (reshape(rcorr,1,length(rcorr)));
47
48 N = size(X,1);
49
50 if N+1 ~= size(D0,1)
51 error('RAPFromMomentsAndCorrelations: Correlation order is different from ME order');
52 end
53
54 T1 = zeros(N);
55 for i=1:N
56 for j=1:i
57 T1(i,j) = 1;
58 end
59 end
60
61 U1 = zeros(N);
62 for i=1:N
63 for j=i:N
64 U1(i,j) = 1 / (N-i+1);
65 end
66 end
67
68 T2 = zeros(M);
69 for i=1:M
70 for j=1:i
71 T2(i,j) = 1;
72 end
73 end
74
75 U2 = zeros(M);
76 for i=1:M
77 for j=i:M
78 U2(i,j) = 1 / (M-i+1);
79 end
80 end
81
82 Y = -inv(T1)*U1*inv(X)*inv(U1)*T1;
83 II = eye(N+1);
84 II(2:end,2:end)=Y;
85 Y=II;
86
87 D1=-D0*inv(U2)*T2*Y*inv(T2)*U2;
88end
89
90
91
92
93
94