Cody

Problem 2915. Matlab Basics II - Find the roots of a function

Solution 1917463

Submitted on 31 Aug 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 = [5 -3 -3 0]; y_correct = [0;1.13;-0.53]; assert(isequal(cross_zero(x),y_correct))

y = 0 1.1307 -0.5307

Assertion failed.

2   Fail
x = [1 2 3 4 5]; y_correct = [0.29 + 1.42i; 0.29 - 1.42i; -1.29 + 0.86i; -1.29 - 0.86i]; assert(isequal(cross_zero(x),y_correct))

y = -1.2878 + 0.8579i -1.2878 - 0.8579i 0.2878 + 1.4161i 0.2878 - 1.4161i

Assertion failed.

3   Fail
x = [2 5 0 -4 0]; y_correct = [0; -2; -1.28; 0.78]; assert(isequal(cross_zero(x),y_correct))

y = 0 -2.0000 -1.2808 0.7808

Assertion failed.