LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
dmap_moment.m
1function MOMENTS=dmap_moment(DMAP,ORDERS)
2% MOMENTS=dmap_moment(DMAP,ORDERS) - Compute raw moments of
3% inter-arrival times for a discrete-time MAP
4%
5% Input:
6% DMAP: a D-MAP in the form of {D0,D1}
7% ORDERS: set of moment orders (1=>E[X], 2=>E[X^2], 3=>E[X^3])
8%
9% Output:
10% MOMENTS: moments returned in the same order of ORDERS
11%
12% NOTE: the previous formula factorial(i)*al*(I-D0)^-i*e returned neither the
13% raw nor the falling-factorial moment for order>=2 (e.g. it gave 4.447 where
14% the true E[X^2] is 2.958). The raw moments below match the JAR
15% implementation and a brute-force sum over P(X=k)=al*D0^(k-1)*D1*e.
16
17D0=DMAP{1};
18D1=DMAP{2};
19N=size(D0,1);
20e=ones(N,1);
21P=inv(eye(N)-D0)*D1;
22al=dtmc_solve(P);
23A=inv(eye(N)-D0);
24Ae=A*e;
25m1=al*Ae;
26for t=1:length(ORDERS)
27 i=ORDERS(t);
28 if any(isnan(D0(:)))
29 MOMENTS(t)=NaN;
30 else
31 switch i
32 case 1
33 MOMENTS(t)=m1;
34 case 2
35 MOMENTS(t)=2*al*A*Ae - m1;
36 case 3
37 MOMENTS(t)=6*al*A*A*Ae - 6*al*A*Ae + m1;
38 otherwise
39 error('dmap_moment: raw moments of order > 3 not implemented');
40 end
41 end
42end
43end
Definition Station.m:245