Cody

# Problem 2130. Orthonormal matrix

Solution 2264655

Submitted on 8 May 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
a=[1 0 0 ;0 1 0;0 0 1] tf = 1; assert(isequal(ortho_normal(a),tf))

a = 1 0 0 0 1 0 0 0 1 Astar = 1 0 0 0 1 0 0 0 1 I = 1 0 0 0 1 0 0 0 1

Unrecognized function or variable 'tf'. Error in ortho_normal (line 4) if tf==I Error in Test1 (line 3) assert(isequal(ortho_normal(a),tf))

2   Fail
a=[0 0 1 0;0 1 0 0;1 0 0 0;0 0 0 1] tf = 1; assert(isequal(ortho_normal(a),tf))

a = 0 0 1 0 0 1 0 0 1 0 0 0 0 0 0 1 Astar = 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 I = 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1

Unrecognized function or variable 'tf'. Error in ortho_normal (line 4) if tf==I Error in Test2 (line 3) assert(isequal(ortho_normal(a),tf))

3   Fail
a=eye(20) k=a; p=a; a(:,1)=k(:,end); a(:,end)=k(:,1); a(:,5)=p(:,9); a(:,9)=p(:,5) tf = 1; assert(isequal(ortho_normal(a),tf))

a = 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0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0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1

Unrecognized function or variable 'tf'. Error in ortho_normal (line 4) if tf==I Error in Test3 (line 9) assert(isequal(ortho_normal(a),tf))

4   Fail
a=[1 0 1 0;0 1 0 0;1 0 0 0;0 0 0 1] tf = 0; assert(isequal(ortho_normal(a),tf))

a = 1 0 1 0 0 1 0 0 1 0 0 0 0 0 0 1 Astar = 2 0 1 0 0 1 0 0 1 0 1 0 0 0 0 1 I = 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1

Unrecognized function or variable 'tf'. Error in ortho_normal (line 4) if tf==I Error in Test4 (line 3) assert(isequal(ortho_normal(a),tf))

5   Fail
a=[0 0 2 0;0 1 0 0;1 0 -1 0;0 0 0 1] tf = 0; assert(isequal(ortho_normal(a),tf))

a = 0 0 2 0 0 1 0 0 1 0 -1 0 0 0 0 1 Astar = 4 0 -2 0 0 1 0 0 -2 0 2 0 0 0 0 1 I = 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1

Unrecognized function or variable 'tf'. Error in ortho_normal (line 4) if tf==I Error in Test5 (line 3) assert(isequal(ortho_normal(a),tf))

6   Fail
a=[1 2 3 ;1 1 5;3 0 1] tf = 0; assert(isequal(ortho_normal(a),tf))

a = 1 2 3 1 1 5 3 0 1 Astar = 14 18 6 18 27 8 6 8 10 I = 1 0 0 0 1 0 0 0 1

Unrecognized function or variable 'tf'. Error in ortho_normal (line 4) if tf==I Error in Test6 (line 3) assert(isequal(ortho_normal(a),tf))

7   Fail
a =[1 0 0 ;0 0 0; 0 0 0] tf = 0; assert(isequal(ortho_normal(a),tf))

a = 1 0 0 0 0 0 0 0 0 Astar = 1 0 0 0 0 0 0 0 0 I = 1 0 0 0 1 0 0 0 1

Unrecognized function or variable 'tf'. Error in ortho_normal (line 4) if tf==I Error in Test7 (line 3) assert(isequal(ortho_normal(a),tf))

### Community Treasure Hunt

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

Start Hunting!