LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
map_moment.m
1function MOMENTS=map_moment(MAP,ORDERS)
2% MOMENTS=map_moment(MAP,ORDERS) - Compute (power) moments of interarrival
3% times of the specified order
4%
5% Input:
6% MAP: a MAP in the form of {D0,D1}
7% ORDERS: set of moment orders (1=>E[X], 2=>E[X^2], ...)
8%
9% Output:
10% MOMENTS: moments returned in the same order of ORDERS
11%
12% Examples:
13% - map_moment(MAP,1:2) return the first two power moments E[X], E[X^2]
14% - map_moment(MAP,2) return the second power moment E[X^2]
15%
16if MAP{1}==0
17 MOMENTS = 0*ORDERS;
18 return
19end
20
21D0=MAP{1};
22D1=MAP{2};
23e=ones(length(D0),1);
24%pi=map_prob(MAP);
25%x=pi*D1;
26%y=e/(pi*D1*e);
27x=map_pie(MAP);
28y=e;
29for t=1:length(ORDERS)
30 i=ORDERS(t);
31 if isnan(D0)
32 MOMENTS(t)=NaN;
33 else
34 A=(inv(-D0)^i);
35 MOMENTS(t)=factorial(i)*x*A*y;
36 end
37end
38end