Cody

Solution 1911277

Submitted on 24 Aug 2019
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   Fail
a = [1 2 3]; n = 3; A_correct = [1 2 3 0 0 0 0 0 0; 0 0 0 1 2 3 0 0 0; 0 0 0 0 0 0 1 2 3]; assert(isequal(block_diagonal(a,n),A_correct))

c = 1 2 3 0 0 0 0 0 0

Output argument "A" (and maybe others) not assigned during call to "block_diagonal". Error in Test1 (line 4) assert(isequal(block_diagonal(a,n),A_correct))

2   Fail
a = []; n = 3; A_correct = []; assert(isequal(block_diagonal(a,n),A_correct))

c = 1×0 empty double row vector

Output argument "A" (and maybe others) not assigned during call to "block_diagonal". Error in Test2 (line 4) assert(isequal(block_diagonal(a,n),A_correct))

3   Fail
a = [1 2 -3]'; n = 0; A_correct = []; assert(isequal(block_diagonal(a,n),A_correct))

c = 1 2 -3

Output argument "A" (and maybe others) not assigned during call to "block_diagonal". Error in Test3 (line 4) assert(isequal(block_diagonal(a,n),A_correct))

4   Fail
a = [3 -2]'; n = 4; A_correct = [3 -2 0 0 0 0 0 0; 0 0 3 -2 0 0 0 0; 0 0 0 0 3 -2 0 0; 0 0 0 0 0 0 3 -2]'; assert(isequal(block_diagonal(a,n),A_correct))

c = 3 -2 0 0 0 0 0 0

Output argument "A" (and maybe others) not assigned during call to "block_diagonal". Error in Test4 (line 4) assert(isequal(block_diagonal(a,n),A_correct))

5   Fail
a = 6; n = 23; A_correct = a*eye(n); assert(isequal(block_diagonal(a,n),A_correct))

c = 6 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

Output argument "A" (and maybe others) not assigned during call to "block_diagonal". Error in Test5 (line 4) assert(isequal(block_diagonal(a,n),A_correct))

6   Fail
a = magic(5); n = 2; A_correct = [a zeros(5); zeros(5) a]; assert(isequal(block_diagonal(a,n),A_correct))

c = Columns 1 through 30 17 23 4 10 11 24 5 6 12 18 1 7 13 19 25 8 14 20 21 2 15 16 22 3 9 0 0 0 0 0 Columns 31 through 50 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

Output argument "A" (and maybe others) not assigned during call to "block_diagonal". Error in Test6 (line 4) assert(isequal(block_diagonal(a,n),A_correct))

7   Fail
a = randi(100,13,8); n = 1; A_correct = a; assert(isequal(block_diagonal(a,n),A_correct))

c = Columns 1 through 30 75 53 12 74 67 64 84 76 48 84 49 48 45 87 67 100 5 1 16 37 51 92 45 9 99 23 32 19 56 60 Columns 31 through 60 17 30 69 32 87 81 17 11 55 73 66 14 41 47 33 42 49 53 100 80 30 14 94 92 48 56 2 67 70 77 Columns 61 through 90 28 53 53 100 67 99 99 69 27 24 10 59 91 100 77 40 19 90 76 61 84 93 1 71 80 65 50 1 88 56 Columns 91 through 104 94 85 43 59 38 40 17 81 62 77 54 55 7 18

Output argument "A" (and maybe others) not assigned during call to "block_diagonal". Error in Test7 (line 4) assert(isequal(block_diagonal(a,n),A_correct))

Suggested Problems

More from this Author1