Cody

# Problem 43651. create a square matrix

Solution 3078696

Submitted on 6 Oct 2020
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
n = 3; y_correct =[1 4 9 4 4 9 9 9 9] assert(isequal(mat(n),y_correct))

y_correct = 1 4 9 4 4 9 9 9 9 ans = 9 9 9 9 9 9 9 9 9 ans = 1 9 9 9 9 9 9 9 9 ans = 4 4 9 4 4 9 9 9 9 ans = 9 9 9 9 9 9 9 9 9

Assertion failed.

2   Fail
n = 4; y_correct = [1 4 9 16 4 4 9 16 9 9 9 16 16 16 16 16] assert(isequal(mat(n),y_correct))

y_correct = 1 4 9 16 4 4 9 16 9 9 9 16 16 16 16 16 ans = 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 ans = 1 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 ans = 4 4 16 16 4 4 16 16 16 16 16 16 16 16 16 16 ans = 9 9 9 16 9 9 9 16 9 9 9 16 16 16 16 16 ans = 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16

Assertion failed.

3   Fail
n= 7; y_correct =[1 4 9 16 25 36 49 4 4 9 16 25 36 49 9 9 9 16 25 36 49 16 16 16 16 25 36 49 25 25 25 25 25 36 49 36 36 36 36 36 36 49 49 49 49 49 49 49 49] assert(isequal(mat(n),y_correct))

y_correct = 1 4 9 16 25 36 49 4 4 9 16 25 36 49 9 9 9 16 25 36 49 16 16 16 16 25 36 49 25 25 25 25 25 36 49 36 36 36 36 36 36 49 49 49 49 49 49 49 49 ans = 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 ans = 1 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 ans = 4 4 49 49 49 49 49 4 4 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 ans = 9 9 9 49 49 49 49 9 9 9 49 49 49 49 9 9 9 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 ans = 16 16 16 16 49 49 49 16 16 16 16 49 49 49 16 16 16 16 49 49 49 16 16 16 16 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 ans = 25 25 25 25 25 49 49 25 25 25 25 25 49 49 25 25 25 25 25 49 49 25 25 25 25 25 49 49 25 25 25 25 25 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 ans = 36 36 36 36 36 36 49 36 36 36 36 36 36 49 36 36 36 36 36 36 49 36 36 36 36 36 36 49 36 36 36 36 36 36 49 36 36 36 36 36 36 49 49 49 49 49 49 49 49 ans = 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49

Assertion failed.

### Community Treasure Hunt

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

Start Hunting!