How to solve an equation using "solve" and get a decimal approx?

30 vues (au cours des 30 derniers jours)
Joey
Joey le 7 Déc 2014
I'm solving an equation for x using "solve(eqn,x)" and everything works fine but I get the fraction answer and I want the decimal answer. How can I change it?

Réponse acceptée

Azzi Abdelmalek
Azzi Abdelmalek le 7 Déc 2014
eq='x^2-2*x-7'
s=double(solve(eq))
  2 commentaires
Joey
Joey le 7 Déc 2014
perfect, thanks!
Julián Escobar
Julián Escobar le 4 Juil 2022
Modifié(e) : Julián Escobar le 4 Juil 2022
Thanks!

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by