How to generate a hankel and toeplitz array of blocks from three series?

6 views (last 30 days)
How to generate a matrix of H and a matrix of T, and my matrix to generate these other two has dimension 3x5
1 2 3 4 5
6 7 8 9 10
11 12 13 14 15
with the H 4x4 block matrix with columns vectors being
[1 6 11]' [2 7 12]' [3 8 13]' [4 9 14]'
[0 0 0 ]' [1 6 11]' [2 7 12]' [3 8 13]'
[0 0 0 ]' [0 0 0 ]' [1 6 11]' [2 7 12]'
[0 0 0 ]' [0 0 0 ]' [0 0 0 ]' [1 6 11]'
with the T 4x4 block matrix with columns vectors being
[2 7 12]' [3 8 13]' [4 9 14]' [5 10 15]'
[3 8 13]' [4 9 14]' [5 10 15]' [0 0 0 ]'
[4 9 14]' [5 10 15]' [0 0 0 ]' [0 0 0 ]'
[5 10 15]' [0 0 0 ]' [0 0 0 ]' [0 0 0 ]'
Thus, the matrices of H and T have this behavior described in the last two matrices. Thanks any help!
PS:I did a previous post only that I had not considered the block array and Matt J was very kind in helping me, but actually to be able to perform the system ID would have that array of blocks.
In this case as I would for instead of just picking the first row, I get all the row and first column, all rows and second column and so on until the next but last column, in the case of the Toeplitz array
H=hankel(A(1,2:4))
T=triu(toeplitz(A(1,1:3)))

Accepted Answer

Andrei Bobrov
Andrei Bobrov on 7 Jul 2019
Edited: Andrei Bobrov on 7 Jul 2019
A = [1 2 3 4 5
6 7 8 9 10
11 12 13 14 15 ];
[m,n] = size(A);
C = num2cell(A,1);
ii = triu(toeplitz(1:n-1));
H = repmat({zeros(m,1)},n-1);
lo = triu(true(n-1));
H(lo) = C(ii(lo))
jj = hankel(2:n);
T = repmat({zeros(m,1)},n-1);
lo = jj > 0;
T(lo) = C(jj(lo))

More Answers (0)

Categories

Find more on Multidimensional Arrays in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!