LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
moment_binotrans.m
1function y = moment_binotrans(x)
2% y = moment_binotrans(x)
3%
4% Binomial transform of the sequence x_0,x_1,...,x_n into y_0,y_1,...,y_n,
5%
6% y_n = sum_{k=0}^{n} (-1)^(n-k) * nchoosek(n,k) * x_k
7%
8% The transform is an involution, so moment_binotransinv undoes it.
9%
10% Input:
11% x: vector of length n+1 holding x_0,...,x_n, i.e. x(i) is the element of
12% order i-1
13%
14% Output:
15% y: vector of length n+1 holding y_0,...,y_n, with the same orientation
16% as x
17%
18% Reference:
19% A. Heindl and A. van de Liefvoort. Moment conversions for discrete
20% distributions. PMCCS, 2003, eq. (8).
21%
22% Example:
23% y = moment_binotrans([1,2,5,15])
24
25xcol = x(:);
26n = length(xcol)-1;
27y = zeros(n+1,1);
28for i = 0:n
29 for k = 0:i
30 y(i+1) = y(i+1) + (-1)^(i-k) * nchoosek(i,k) * xcol(k+1);
31 end
32end
33if isrow(x)
34 y = y.';
35end
36end
Definition Station.m:245