Cody

# Problem 42752. Matrix diagonalization

Solution 1890047

Submitted on 2 Aug 2019 by Gergely Patay
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
A=magic(3); B=[15.000000000000004 0 0 0 4.898979485566359 0 0 0 -4.898979485566358] y_correct=1; assert(isequal(Check_Diag(A,B),y_correct))

B = 15.0000 0 0 0 4.8990 0 0 0 -4.8990

2   Pass
A=eye(5); B=eye(5); y_correct=1; assert(isequal(Check_Diag(A,B),y_correct))

3   Pass
A=spiral(2) B=[3 4 4 9]; y_correct=0; assert(isequal(Check_Diag(A,B),y_correct))

A = 1 2 4 3

4   Pass
A=pascal(3) B=[ 1.127016653792583 0 0 0 2.000000000000000 0 0 0 8.872983346207416] y_correct=0; assert(isequal(Check_Diag(A,B),y_correct))

A = 1 1 1 1 2 3 1 3 6 B = 1.1270 0 0 0 2.0000 0 0 0 8.8730

5   Pass
A=spiral(3) B=[ 15.738398236975144 0 0 0 -3.388172132922506 0 0 0 -1.350226104052633]; y_correct=1; assert(isequal(Check_Diag(A,B),y_correct))

A = 7 8 9 6 1 2 5 4 3

### Community Treasure Hunt

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

Start Hunting!