In R2018a, they finally stopped letting you just provide a string input. It has been something they have been threatening for several years now. The time is now up.
However, you can just do this:
syms x
xroots = solve(3*x^5+4*x^4+7*x^3+2*x^2+9*x+12)
xroots =
root(z^5 + (4*z^4)/3 + (7*z^3)/3 + (2*z^2)/3 + 3*z + 4, z, 1)
root(z^5 + (4*z^4)/3 + (7*z^3)/3 + (2*z^2)/3 + 3*z + 4, z, 2)
root(z^5 + (4*z^4)/3 + (7*z^3)/3 + (2*z^2)/3 + 3*z + 4, z, 3)
root(z^5 + (4*z^4)/3 + (7*z^3)/3 + (2*z^2)/3 + 3*z + 4, z, 4)
root(z^5 + (4*z^4)/3 + (7*z^3)/3 + (2*z^2)/3 + 3*z + 4, z, 5)
Then resolve that mess into numbers using vpa:
vpa(xroots)
ans =
-0.95832248349981782331007510989358
- 0.86122033780576856901169130559204 - 1.4377338954885689163709476213772i
- 0.86122033780576856901169130559204 + 1.4377338954885689163709476213772i
0.67371491288901081400006219387216 - 1.0159473094101229496455473520944i
0.67371491288901081400006219387216 + 1.0159473094101229496455473520944i
Or, you could have just used vpasolve directly.
vpasolve(3*x^5+4*x^4+7*x^3+2*x^2+9*x+12)
ans =
-0.95832248349981782331007510989358
- 0.86122033780576856901169130559204 + 1.4377338954885689163709476213772i
- 0.86122033780576856901169130559204 - 1.4377338954885689163709476213772i
0.67371491288901081400006219387216 - 1.0159473094101229496455473520944i
0.67371491288901081400006219387216 + 1.0159473094101229496455473520944i
Finally, if you absolutely insist on providing it as a string? Use str2sym.
vpasolve(str2sym('3*x^5+4*x^4+7*x^3+2*x^2+9*x+12'))
ans =
-0.95832248349981782331007510989358
- 0.86122033780576856901169130559204 + 1.4377338954885689163709476213772i
- 0.86122033780576856901169130559204 - 1.4377338954885689163709476213772i
0.67371491288901081400006219387216 - 1.0159473094101229496455473520944i
0.67371491288901081400006219387216 + 1.0159473094101229496455473520944i