Cody

Solution 2103019

Submitted on 23 Jan 2020 by KO
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
x = [1 2 3 4 5 5 6 5 7 9 8 3]; y_correct = [0 0 0 4 0 0 6 0 0 9 0 0]; assert(isequal(your_fcn_name(x),y_correct))

m = 3 n = 4 zz = 4 6 9 z = 4 3 2 y = 0 0 0 0 0 0 0 0 0 0 0 0 y = 0 0 0 4 0 0 0 0 0 0 0 0 y = 0 0 0 4 0 0 6 0 0 0 0 0 y = 0 0 0 4 0 0 6 0 0 9 0 0

2   Pass
x = magic(4); y_correct = [16 0 0 0 0 11 0 0 0 0 0 12 0 0 15 0]; assert(isequal(your_fcn_name(x),y_correct))

m = 4 n = 4 zz = 16 11 12 15 z = 1 2 4 3 y = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 y = 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 y = 16 0 0 0 0 11 0 0 0 0 0 0 0 0 0 0 y = 16 0 0 0 0 11 0 0 0 0 0 12 0 0 0 0 y = 16 0 0 0 0 11 0 0 0 0 0 12 0 0 15 0

3   Pass
x = pi; y_correct = pi; assert(isequal(your_fcn_name(x),y_correct))

m = 1 n = 1 zz = 3.1416 z = 1 y = 0 y = 3.1416

4   Pass
x = 0; y_correct = 0; assert(isequal(your_fcn_name(x),y_correct))

m = 1 n = 1 zz = 0 z = 1 y = 0 y = 0

5   Pass
x = toeplitz(1:5); y_correct = [ 0 0 0 0 5 0 0 0 0 4 3 0 0 0 0 4 0 0 0 0 5 0 0 0 0]; assert(isequal(your_fcn_name(x),y_correct))

m = 5 n = 5 zz = 5 4 3 4 5 z = 5 5 1 1 1 y = 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 y = 0 0 0 0 5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 y = 0 0 0 0 5 0 0 0 0 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 y = 0 0 0 0 5 0 0 0 0 4 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 y = 0 0 0 0 5 0 0 0 0 4 3 0 0 0 0 4 0 0 0 0 0 0 0 0 0 y = 0 0 0 0 5 0 0 0 0 4 3 0 0 0 0 4 0 0 0 0 5 0 0 0 0

6   Pass
x = ones(5); y_correct = [ 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0]; assert(isequal(your_fcn_name(x),y_correct))

m = 5 n = 5 zz = 1 1 1 1 1 z = 1 1 1 1 1 y = 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 y = 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 y = 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 y = 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 y = 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 y = 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0

7   Pass
x =nchoosek(7:9,3); y_correct =[ 0 0 9]; assert(isequal(your_fcn_name(x),y_correct))

m = 1 n = 3 zz = 9 z = 3 y = 0 0 0 y = 0 0 9

8   Pass
x =nchoosek(4:9,2); y_correct = [ 0 5 0 6 0 7 0 8 0 9 0 6 0 7 0 8 0 9 0 7 0 8 0 9 0 8 0 9 0 9]; assert(isequal(your_fcn_name(x),y_correct))

m = 15 n = 2 zz = 5 6 7 8 9 6 7 8 9 7 8 9 8 9 9 z = 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 y = 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 y = 0 5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0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