LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
MarginalMomentsFromTrace.m
1% moms = MarginalMomentsFromTrace(trace, K)
2%
3% Returns the marginal moments of a trace.
4%
5% Parameters
6% ----------
7% trace : vector of doubles
8% The trace data
9% K : int
10% The number of moments to compute
11%
12% Returns
13% -------
14% moms : vector of doubles
15% The (raw) moments of the trace
16
17function moms = MarginalMomentsFromTrace (trace, K)
18
19 if nargin<2
20 K = 5;
21 end
22
23 moms = zeros(1,K);
24 for i=1:K
25 moms(i) = sum(trace.^i);
26 end
27 moms = moms / length(trace);
28end