Cody

# Problem 2064. Generate this matrix

Solution 1120964

Submitted on 12 Feb 2017 by Jihye Sofia Seo
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
n = 2; y_correct = [-4 -3 -2 -1 0 -3 -2 -1 0 1 -2 -1 0 1 2 -1 0 1 2 3 0 1 2 3 4]; assert(isequal(your_fcn_name(n),y_correct))

hor = 1 2 3 4 5 ver = 1 2 3 4 5 y = 0 -1 -2 -3 -4 1 0 -1 -2 -3 2 1 0 -1 -2 3 2 1 0 -1 4 3 2 1 0 y = -4 -3 -2 -1 0 -3 -2 -1 0 1 -2 -1 0 1 2 -1 0 1 2 3 0 1 2 3 4

2   Pass
n = 5; y_correct = [-10 -9 -8 -7 -6 -5 -4 -3 -2 -1 0 -9 -8 -7 -6 -5 -4 -3 -2 -1 0 1 -8 -7 -6 -5 -4 -3 -2 -1 0 1 2 -7 -6 -5 -4 -3 -2 -1 0 1 2 3 -6 -5 -4 -3 -2 -1 0 1 2 3 4 -5 -4 -3 -2 -1 0 1 2 3 4 5 -4 -3 -2 -1 0 1 2 3 4 5 6 -3 -2 -1 0 1 2 3 4 5 6 7 -2 -1 0 1 2 3 4 5 6 7 8 -1 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 10]; assert(isequal(your_fcn_name(n),y_correct))

hor = 1 2 3 4 5 6 7 8 9 10 11 ver = 1 2 3 4 5 6 7 8 9 10 11 y = 0 -1 -2 -3 -4 -5 -6 -7 -8 -9 -10 1 0 -1 -2 -3 -4 -5 -6 -7 -8 -9 2 1 0 -1 -2 -3 -4 -5 -6 -7 -8 3 2 1 0 -1 -2 -3 -4 -5 -6 -7 4 3 2 1 0 -1 -2 -3 -4 -5 -6 5 4 3 2 1 0 -1 -2 -3 -4 -5 6 5 4 3 2 1 0 -1 -2 -3 -4 7 6 5 4 3 2 1 0 -1 -2 -3 8 7 6 5 4 3 2 1 0 -1 -2 9 8 7 6 5 4 3 2 1 0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