Cody

# Problem 43625. Calculate roots of polynomial given as vector array.

Solution 1036818

Submitted on 29 Oct 2016 by Matthew Eicholtz
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 0 5 0 3]; y_correct = [-2.7267 + 0.0000i ;0.4784 + 1.0983i ;0.4784 - 1.0983i ;-0.1150 + 0.8680i ;-0.1150 - 0.8680i]; y=PolRoot(x) assert(abs(y(1)-y_correct(1))<10^(-4)) assert(abs(y(2)-y_correct(2))<10^(-4)) assert(abs(y(3)-y_correct(3))<10^(-4)) assert(abs(y(4)-y_correct(4))<10^(-4))

y = -2.7267 + 0.0000i 0.4784 + 1.0983i 0.4784 - 1.0983i -0.1150 + 0.8680i -0.1150 - 0.8680i

2   Pass
x = [3 2 5 1 0 2]; y_correct = [-0.3205 + 1.2968i; -0.3205 - 1.2968i; -0.7915 + 0.0000i; 0.3829 + 0.5704i; 0.3829 - 0.5704i]; y=PolRoot(x) assert(abs(y(1)-y_correct(1))<10^(-4)) assert(abs(y(2)-y_correct(2))<10^(-4)) assert(abs(y(3)-y_correct(3))<10^(-4)) assert(abs(y(4)-y_correct(4))<10^(-4))

y = -0.3205 + 1.2968i -0.3205 - 1.2968i -0.7915 + 0.0000i 0.3829 + 0.5704i 0.3829 - 0.5704i