LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
mtrace_moment_simple.m
1function MC = mtrace_moment_simple(T,L,k)
2% Computes the k-th order moment of the inter-arrival time between an event
3% of class i and an event of class j, for all possible pairs of classes.
4% Input
5% T: inter-arrival times
6% L: labels
7% k: order of the moment
8% Output
9% MC: the element in (i,j) is the k-th order moment of the inter-arrival
10% time between an event of class i and an event of class j
11
12marks = unique(L);
13C = length(marks);
14
15MC = zeros(C,C);
16count = zeros(C,C);
17
18for t = 2:length(T)
19 for i = 1:C
20 for j = 1:C
21 if L(t-1) == marks(i) && L(t) == marks(j)
22 MC(i,j) = MC(i,j) + T(t)^k;
23 count(i,j) = count(i,j) + 1;
24 end
25 end
26 end
27end
28
29MC = MC ./ count;