Solve Function not working properly
2 views (last 30 days)
Show older comments
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!
0 Comments
Answers (2)
Azzi Abdelmalek
on 22 Feb 2013
Edited: Azzi Abdelmalek
on 22 Feb 2013
syms x
sol=solve(x.^3-6*x.^2+18)
sol=subs(sol)
0 Comments
Walter Roberson
on 22 Feb 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
0 Comments
See Also
Categories
Find more on Linear Algebra in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!