Finding approximate real solution to a equation

Can anyone please help me, how to find the approximate real solution to the following polynomial:
syms x
eqn=0.0941*x^3+0.1926*x-1500;
I used solve and simplify functions, but I don't get a real value.

 Respuesta aceptada

Alan Stevens
Alan Stevens el 22 de Sept. de 2021
You don't need syms here. Try the roots function.
help roots

3 comentarios

Vinit Nagda
Vinit Nagda el 22 de Sept. de 2021
@Alan Stevens Is there an arguement to get only real roots? I do not see in the help documentation.
You could try something like
coeffs = [0.0941, 0, 0.1926, -1500];
r = roots(coeffs);
indicator = find(r==real(r));
disp(r(indicator))
25.1400
Vinit Nagda
Vinit Nagda el 22 de Sept. de 2021
Thank you very much @Alan Stevens

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Symbolic Math Toolbox en Centro de ayuda y File Exchange.

Productos

Versión

R2020b

Preguntada:

el 22 de Sept. de 2021

Comentada:

el 22 de Sept. de 2021

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by