LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
HankelMomsFromMoms.m
1% hm = HankelMomsFromMoms(m)
2%
3% Returns the Hankel moments given the raw moments.
4%
5% The raw moments are: `m_i=E(\mathcal{X}^i)`
6%
7% The ith Hankel moment is the determinant of matrix
8% `\Delta_{i/2}`, if i is even,
9% and it is the determinant of `\Delta^{(1)}_{(i+1)/2}`,
10% if i is odd. For the definition of matrices `\Delta`
11% and `\Delta^{(1)}` see [1]_.
12%
13% Parameters
14% ----------
15% m : vector of doubles
16% The list of raw moments (starting with the first
17% moment)
18%
19% Returns
20% -------
21% hm : vector of doubles
22% The list of Hankel moments
23%
24% References
25% ----------
26% .. [1] http://en.wikipedia.org/wiki/Stieltjes_moment_problem
27
28function hm=HankelMomsFromMoms(m)
29
30 hm = [];
31 for i=0:length(m)-1
32 if rem(i,2) == 0
33 N = i/2 + 1;
34 H = hankel(m(1:N), m(N:2*N-1));
35 else
36 N = (i+1) / 2 + 1;
37 H = hankel([1,m(1:N-1)], m(N-1:2*N-2));
38 end
39 hm = [hm, det(H)];
40 end
41end