Cody

# Problem 45235. generate the matrix

Solution 2061410

Submitted on 18 Dec 2019 by Binbin Qi
• Size: 25
• This is the leading solution.
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; y=1; z=1; y_correct = eye(3); assert(isequal(mat_bl(x,y,z),y_correct))

2   Pass
x = 2; y=2; z=2; y_correct = [2 2 0 0 0 0; 2 2 0 0 0 0; 0 0 2 2 0 0; 0 0 2 2 0 0; 0 0 0 0 2 2; 0 0 0 0 2 2] assert(isequal(mat_bl(x,y,z),y_correct))

y_correct = 2 2 0 0 0 0 2 2 0 0 0 0 0 0 2 2 0 0 0 0 2 2 0 0 0 0 0 0 2 2 0 0 0 0 2 2

3   Pass
x = 4; y=1; z=3; y_correct = [4 4 4 4 0 0 0 0 4 4 4 4 0 0 0 0 4 4 4 4 0 0 0 0 4 4 4 4 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 3 3 3 0 0 0 0 0 3 3 3 0 0 0 0 0 3 3 3] assert(isequal(mat_bl(x,y,z),y_correct))

y_correct = 4 4 4 4 0 0 0 0 4 4 4 4 0 0 0 0 4 4 4 4 0 0 0 0 4 4 4 4 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 3 3 3 0 0 0 0 0 3 3 3 0 0 0 0 0 3 3 3

### Community Treasure Hunt

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

Start Hunting!