-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhankel_mo.m
47 lines (34 loc) · 834 Bytes
/
hankel_mo.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
function H = hankel_mo(L,nrnc)
% H = hankel_mo(X);
%
% H = hankel_mo(X,nrnc);
%
% X: Data DIMS x N
% nrnc: size of hankel matrix nr x nc
%
% treat every column as a observation
% form a multi output hankel e.g.
% | c1 c2 c3 |
% H = | c2 c3 c4 |
% | c3 c4 c5 |
[dim N] = size(L);
if dim>N
%warning('DIMS>N. Make sure X is DIMSxN (row vector)!')
end
if nargin<2
% nr = ceil(N/2)*dim;
nr = ceil(N/(dim+1))*dim;
nc = N - ceil(N/(dim+1))+1;
else
nr = nrnc(1);
nc = nrnc(2);
end
% nc = N - ceil(N/(dim+1))+1;
% nc = N - (nr/dim)+1;
cidx = [0 : nc-1 ];
ridx = [1 : nr]';
H = ridx(:,ones(nc,1)) + dim*cidx(ones(nr,1),:); % Hankel subscripts
t = L(:);
temp.type = '()';
temp.subs = {H(:)};
H = reshape( subsref( t, temp ), size( H ) );