Cody

Problem 42501. Toeplitize a matrix

Solution 3049201

Submitted on 3 Oct 2020 by mohsen
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(toeplitize(A),B))

f = 100 d = 100 no = 1 m = 100 cat = 100 b = 100 di = 100 answer = 100 B = 100

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

f = 9 4 2 3 2 0 d = 2 no = 1 m = 2 cat = 2 b = 2 di = 0 0 0 0 0 0 2 0 0 di = 0 0 0 0 2 0 answer = 0 0 0 0 2 0 d = 2 0 no = 2 m = 1 cat = 1 cat = 1 1 b = 1 1 di = 0 0 0 1 0 0 0 1 0 di = 0 0 1 0 0 1 answer = 0 0 1 0 2 1 d = 9 3 no = 2 m = 6 cat = 6 cat = 6 6 b = 6 6 di = 6 0 0 6 di = 6 0 0 6 0 0 answer = 6 0 1 6 2 1 d = 4 no = 1 m = 4 cat = 4 b = 4 di = 0 4 0 0 di = 0 4 0 0 0 0 answer = 6 4 1 6 2 1 B = 6 4 1 6 2 1

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

f = 7 10 9 5 1 0 d = 5 no = 1 m = 5 cat = 5 b = 5 di = 0 0 5 0 di = 0 0 0 5 0 0 answer = 0 0 0 5 0 0 d = 7 1 no = 2 m = 4 cat = 4 cat = 4 4 b = 4 4 di = 4 0 0 4 di = 4 0 0 0 4 0 answer = 4 0 0 5 4 0 d = 10 0 no = 2 m = 5 cat = 5 cat = 5 5 b = 5 5 di = 0 5 0 0 0 5 0 0 0 di = 0 5 0 0 0 5 answer = 4 5 0 5 4 5 d = 9 no = 1 m = 9 cat = 9 b = 9 di = 0 0 9 0 0 0 0 0 0 di = 0 0 9 0 0 0 answer = 4 5 9 5 4 5 B = 4 5 9 5 4 5

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

f = 6 3 2 7 3 5 1 2 3 7 10 2 d = 3 no = 1 m = 3 cat = 3 b = 3 di = 0 0 0 0 0 0 3 0 0 di = 0 0 0 0 0 0 0 0 3 0 0 0 answer = 0 0 0 0 0 0 0 0 3 0 0 0 d = 3 7 no = 2 m = 5 cat = 5 cat = 5 5 b = 5 5 di = 0 0 0 5 0 0 0 5 0 di = 0 0 0 0 5 0 0 0 0 5 0 0 answer = 0 0 0 0 5 0 0 0 3 5 0 0 d = 6 5 10 no = 3 m = 7 cat = 7 cat = 7 7 cat = 7 7 7 b = 7 7 7 di = 7 0 0 0 7 0 0 0 7 di = 7 0 0 0 0 7 0 0 0 0 7 0 answer = 7 0 0 0 5 7 0 0 3 5 7 0 d = 3 1 2 no = 3 m = 2 cat = 2 cat = 2 2 cat = 2 2 2 b = 2 2 2 di = 0 2 0 0 0 0 2 0 0 0 0 2 0 0 0 0 di = 0 2 0 0 0 0 2 0 0 0 0 2 answer = 7 2 0 0 5 7 2 0 3 5 7 2 d = 2 2 no = 2 m = 2 cat = 2 cat = 2 2 b = 2 2 di = 0 0 2 0 0 0 0 2 0 0 0 0 0 0 0 0 di = 0 0 2 0 0 0 0 2 0 0 0 0 answer = 7 2 2 0 5 7 2 2 3 5 7 2 d = 7 no = 1 m = 7 cat = 7 b = 7 di = 0 0 0 7 0 0 0 0 0 0 0 0 0 0 0 0 di = 0 0 0 7 0 0 0 0 0 0 0 0 answer = 7 2 2 7 5 7 2 2 3 5 7 2 B = 7 2 2 7 5 7 2 2 3 5 7 2

5   Pass
A = [3,-1,-10,1,4,2;8,4,0,4,2,0;2,0,-1,10,-3,6]; B = [2,3,-3,3,2,2;4,2,3,-3,3,2;2,4,2,3,-3,3]; assert(isequal(toeplitize(A),B))

f = 3 -1 -10 1 4 2 8 4 0 4 2 0 2 0 -1 10 -3 6 d = 2 no = 1 m = 2 cat = 2 b = 2 di = 0 0 0 0 0 0 2 0 0 di = 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0 0 answer = 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0 0 d = 8 0 no = 2 m = 4 cat = 4 cat = 4 4 b = 4 4 di = 0 0 0 4 0 0 0 4 0 di = 0 0 0 0 0 0 4 0 0 0 0 0 0 4 0 0 0 0 answer = 0 0 0 0 0 0 4 0 0 0 0 0 2 4 0 0 0 0 d = 3 4 -1 no = 3 m = 2 cat = 2 cat = 2 2 cat = 2 2 2 b = 2 2 2 di = 2 0 0 0 2 0 0 0 2 di = 2 0 0 0 0 0 0 2 0 0 0 0 0 0 2 0 0 0 answer = 2 0 0 0 0 0 4 2 0 0 0 0 2 4 2 0 0 0 d = -1 0 10 no = 3 m = 3 cat = 3 cat = 3 3 cat = 3 3 3 b = 3 3 3 di = 0 3 0 0 0 0 3 0 0 0 0 3 0 0 0 0 di = 0 3 0 0 0 0 3 0 0 0 0 3 di = 0 3 0 0 0 0 0 0 3 0 0 0 0 0 0 3 0 0 answer = 2 3 0 0 0 0 4 2 3 0 0 0 2 4 2 3 0 0 d = -10 4 -3 no = 3 m = -3 cat = -3 cat = -3 -3 cat = -3 -3 -3 b = -3 -3 -3 di = 0 0 -3 0 0 0 0 0 -3 0 0 0 0 0 -3 0 0 0 0 0 0 0 0 0 0 di = 0 0 -3 0 0 0 0 0 -3 0 0 0 0 0 -3 di = 0 0 -3 0 0 0 0 0 0 -3 0 0 0 0 0 0 -3 0 answer = 2 3 -3 0 0 0 4 2 3 -3 0 0 2 4 2 3 -3 0 d = 1 2 6 no = 3 m = 3 cat = 3 cat = 3 3 cat = 3 3 3 b = 3 3 3 di = 0 0 0 3 0 0 0 0 0 0 3 0 0 0 0 0 0 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 di = 0 0 0 3 0 0 0 0 0 0 3 0 0 0 0 0 0 3 answer = 2 3 -3 3 0 0 4 2 3 -3 3 0 2 4 2 3 -3 3 d = 4 0 no = 2 m = 2 cat = 2 cat = 2 2 b = 2 2 di = 0 0 0 0 2 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 di = 0 0 0 0 2 0 0 0 0 0 0 2 0 0 0 0 0 0 answer = 2 3 -3 3 2 0 4 2 3 -3 3 2 2 4 2 3 -3 3 d = 2 no = 1 m = 2 cat = 2 b = 2 di = 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 di = 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 answer = 2 3 -3 3 2 2 4 2 3 -3 3 2 2 4 2 3 -3 3 B = 2 3 -3 3 2 2 4 2 3 -3 3 2 2 4 2 3 -3 3

Suggested Problems

More from this Author30

Community Treasure Hunt

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

Start Hunting!