Test | Status | Code Input and Output |
---|---|---|
1 | Pass |
n = 2;
y = [1 0;0 1];
assert(isequal(M_Const(n),y))
n =
1
y =
1 0
0 1
|
2 | Pass |
n = 4;
y = [1 2 0 0
1 2 0 0;
0 0 2 1
0 0 2 1];
assert(isequal(M_Const(n),y))
n =
2
y =
1 2 0 0
1 2 0 0
0 0 2 1
0 0 2 1
|
3 | Pass |
n = 6;
y = [1 2 3 0 0 0
1 2 3 0 0 0
1 2 3 0 0 0
0 0 0 3 2 1
0 0 0 3 2 1
0 0 0 3 2 1];
assert(isequal(M_Const(n),y))
n =
3
y =
1 2 3 0 0 0
1 2 3 0 0 0
1 2 3 0 0 0
0 0 0 3 2 1
0 0 0 3 2 1
0 0 0 3 2 1
|
4 | Pass |
n = 8;
y = [ 1 2 3 4 0 0 0 0
1 2 3 4 0 0 0 0
1 2 3 4 0 0 0 0
1 2 3 4 0 0 0 0
0 0 0 0 4 3 2 1
0 0 0 0 4 3 2 1
0 0 0 0 4 3 2 1
0 0 0 0 4 3 2 1];
assert(isequal(M_Const(n),y))
n =
4
y =
1 2 3 4 0 0 0 0
1 2 3 4 0 0 0 0
1 2 3 4 0 0 0 0
1 2 3 4 0 0 0 0
0 0 0 0 4 3 2 1
0 0 0 0 4 3 2 1
0 0 0 0 4 3 2 1
0 0 0 0 4 3 2 1
|
Find the sum of all the numbers of the input vector
31958 Solvers
Find the longest sequence of 1's in a binary sequence.
3370 Solvers
386 Solvers
Set the array elements whose value is 13 to 0
939 Solvers
187 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!