Cody

Problem 45221. cofactor matrix

Solution 2057167

Submitted on 13 Dec 2019 by Martin C.
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,2,3;0,4,5;1,0,6]; y_correct = [24 5 -4 -12 3 2 -2 -5 4] assert(isequal(cofactor_mat(x),y_correct))

y_correct = 24 5 -4 -12 3 2 -2 -5 4 y = 24.0000 -12.0000 -2.0000 5.0000 3.0000 -5.0000 -4.0000 2.0000 4.0000 y = 24 5 -4 -12 3 2 -2 -5 4

2   Pass
x=[1,7;2,0] y_correct=[0 -2 -7 1] assert(isequal(cofactor_mat(x),y_correct))

x = 1 7 2 0 y_correct = 0 -2 -7 1 y = 0.0000 -7.0000 -2.0000 1.0000 y = 0 -2 -7 1

3   Pass
x=zeros(5) y_correct=zeros(5) assert(isequal(cofactor_mat(x),y_correct))

x = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 y_correct = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 y = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 y = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

Suggested Problems

More from this Author149

Community Treasure Hunt

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

Start Hunting!