Cody

# Problem 44687. basic matrix operations: rotate and find sum of diagonal elements of the resultant matrix

Solution 1987859

Submitted on 23 Oct 2019
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
x = [1 2 3 4; 5 6 7 8;8 10, 12, -2;-1 -3 -5,-7]; y_correct = 20; assert(isequal(matrix_manipulation(x),y_correct))

x = 4 8 -2 -7 3 7 12 -5 2 6 10 -3 1 5 8 -1 ans = 4 7 10 -1 ans = 1 6 12 -7

Assertion failed.

2   Fail
x = ones(5).*3 y_correct = 15; assert(isequal(matrix_manipulation(x),y_correct))

x = 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 x = 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 ans = 3 3 3 3 3 ans = 3 3 3 3 3

Assertion failed.

3   Fail
a=[3,2,5] x = [a;a;a]; y_correct = 10; assert(isequal(matrix_manipulation(x),y_correct))

a = 3 2 5 x = 5 5 5 2 2 2 3 3 3 ans = 5 2 3 ans = 3 2 5

Assertion failed.

4   Fail
x = [-5,25,-10;8,-18,10;-2,7,-1] y_correct = -30; assert(isequal(matrix_manipulation(x),y_correct))

x = -5 25 -10 8 -18 10 -2 7 -1 x = -10 10 -1 25 -18 7 -5 8 -2 ans = -10 -18 -2 ans = -5 -18 -1

Assertion failed.

### Community Treasure Hunt

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

Start Hunting!