Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Solution 398806

Submitted on 7 Feb 2014 by J-G van der Toorn

Correct

10Size
This is the leading solution.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test
Code Input and Output
1
Pass
 
%%
x = [1 5 8 9 7 4 5];
y_correct = roots(x);
assert(isequal(return_root(x),y_correct))
x = [1 0 0 48 50];
y_correct =  roots(x);
assert(isequal(return_root(x),y_correct))
x = [11 55 4 6 ];
y_correct = roots(x)
assert(isequal(return_root(x),y_correct))
y_correct =
  -4.9488 + 0.0000i
  -0.0256 + 0.3310i
  -0.0256 - 0.3310i