LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
Trace.m
1classdef Trace < Replayer
2 % Empirical time series from a trace, alias for Replayer
3 %
4 % Copyright (c) 2012-2026, Imperial College London
5 % All rights reserved.
6
7 methods
8 %Constructor
9 function self = Trace(data)
10 % SELF = TRACE(data)
11 self@Replayer(data);
12 end
13
14 function [m1,m2,m3,scv,skew] = getMoments(self)
15 data = self.data;
16 [row,col] = size(data);
17 m1 = 0; % the first moment
18 m2 = 0; % the second moment
19 m3 = 0; % the third moment
20 for i = 1:1:row-1
21 bin1 = ((data(i+1,2)-data(i,2))/2+data(i,2))*((data(i+1,1)-data(i,1)));
22 bin2 = ((data(i+1,2)-data(i,2))/2+data(i,2))^2*((data(i+1,1)-data(i,1)));
23 bin3 = ((data(i+1,2)-data(i,2))/2+data(i,2))^3*((data(i+1,1)-data(i,1)));
24 m1 = m1+bin1;
25 m2 = m2+bin2;
26 m3 = m3+bin3;
27 end
28 scv = (m2/m1^2)-1;
29 skew = (m3-3*m1*(m2-m1^2)-m1^3)/((m2-m1^2)^(3/2));
30 end
31 end
32end
33