Solve Function not working properly
Afficher commentaires plus anciens
Hello I am new to matlab and am having a lot of difficulty solving a simple algebraic equation. I want to solve:
X^3-6X^2+18=0 for X which should be the value 2 however matlab is providing me with a very different answer. The code i am typing is:
solve(x.^3-6*X.^2+18,X)
and the answer is as follows:
ans=
-2.941250671603633621189774
1.230510698487091567868454 - 2.588291611086283205444294848*i
and continues to repeat with similar integers for a number of lines.
Any help is appreciated. Thanks!
Réponses (2)
Azzi Abdelmalek
le 22 Fév 2013
Modifié(e) : Azzi Abdelmalek
le 22 Fév 2013
syms x
sol=solve(x.^3-6*x.^2+18)
sol=subs(sol)
Walter Roberson
le 22 Fév 2013
2 is not the solution for that, even if we read "6X^2" as possibly meaning (6X)^2. 2 is, however, a solution for
x^3-6*x^2+16
Catégories
En savoir plus sur Polynomials dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!