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
|
306 Solvers
321 Solvers
Find the Nth Root of a Given Number
187 Solvers
259 Solvers
307 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!