Cody

Solution 1584507

Submitted on 16 Jul 2018 by Jiahang Li
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))

ans = -2.7267 + 0.0000i 0.4784 + 1.0983i 0.4784 - 1.0983i -0.1150 + 0.8680i -0.1150 - 0.8680i 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))

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