Cody

# Problem 3094. Hankelize a matrix

Solution 1587380

Submitted on 19 Jul 2018 by Radha Kumari
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Pass
A = 100; B = 100; assert(isequal(hankelize(A),B));

i = 0 A = (1,1) 100

2   Pass
A = [2,0 2,3 9,4]; B = [2,1 1,6 6,4]; assert(isequal(hankelize(A),B));

i = -2 A = (2,1) 3 (3,1) 4 (1,2) 2 (2,2) 2 (3,2) 9 i = -1 A = (2,1) 6 (3,1) 4 (1,2) 2 (2,2) 2 (3,2) 6 i = 0 A = (1,1) 1 (2,1) 6 (3,1) 4 (1,2) 2 (2,2) 1 (3,2) 6 i = 1 A = (1,1) 1 (2,1) 6 (3,1) 4 (1,2) 2 (2,2) 1 (3,2) 6

3   Pass
A = [5 1 0 7 10 9]; B = [5 4 5 4 5 9]; assert(isequal(hankelize(A),B));

i = -1 A = (2,1) 9 (1,2) 1 (2,2) 10 (1,3) 5 (2,3) 7 i = 0 A = (1,1) 5 (2,1) 9 (1,2) 1 (2,2) 5 (1,3) 5 (2,3) 7 i = 1 A = (1,1) 5 (2,1) 9 (1,2) 4 (2,2) 5 (1,3) 5 (2,3) 4 i = 2 A = (1,1) 5 (2,1) 9 (1,2) 4 (2,2) 5 (1,3) 5 (2,3) 4

4   Pass
A = [3 7 10 2 3 5 1 2 6 3 2 7]; B = [3 5 7 2 5 7 2 2 7 2 2 7]; assert(isequal(hankelize(A),B));

i = -2 A = (1,1) 2 (2,1) 2 (3,1) 7 (1,2) 10 (2,2) 1 (3,2) 2 (1,3) 7 (2,3) 5 (3,3) 3 (1,4) 3 (2,4) 3 (3,4) 6 i = -1 A = (1,1) 2 (2,1) 2 (3,1) 7 (1,2) 10 (2,2) 1 (3,2) 2 (1,3) 7 (2,3) 5 (3,3) 3 (1,4) 3 (2,4) 3 (3,4) 6 i = 0 A = (1,1) 2 (2,1) 2 (3,1) 7 (1,2) 10 (2,2) 2 (3,2) 2 (1,3) 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