Cody

Problem 1057. Given a matrix, return the last eigen value

Solution 2055575

Submitted on 12 Dec 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 0 4 3 2 5 -1 0 0 0 2 3 4 3 2 5 4 0 -9 0 0 -2 -3]; k = eig(x); y_correct = k(end); assert(isequal(last_eig(x),y_correct))

Error in solution: Line: 2 Column: 6 Indexing with parentheses '()' must appear as the last operation of a valid indexing expression.

2   Fail
x = [1 2 3 6 4 -1 -9 1 3]; k = eig(x); y_correct = k(end); assert(isequal(last_eig(x),y_correct))

Error in solution: Line: 2 Column: 6 Indexing with parentheses '()' must appear as the last operation of a valid indexing expression.

3   Fail
x = magic(6); k = eig(x); y_correct = k(end); assert(isequal(last_eig(x),y_correct))

Error in solution: Line: 2 Column: 6 Indexing with parentheses '()' must appear as the last operation of a valid indexing expression.

Suggested Problems

More from this Author11