solving a cubic equation

조회 수: 303 (최근 30일)
vaggelis vaggelakis
vaggelis vaggelakis 2014년 8월 20일
댓글: Christopher Creutzig 2014년 8월 29일
I am using the command
x = solve('a*x^3 + b*x^2 + c*x + d')
to get the polynomial's roots. It returns a symbolic answer. Then i evaluate the a,b,c,d and i do copy-paste the first symbolic answer and then "enter" to get a numerical answer.
The numbers i get (1 almost real and 2 complex, as it is expected) are not roots of the equation!
I am looking for the poles of a mechanical system, so the roots must exist... What am i doing wrong?
  댓글 수: 1
Christopher Creutzig
Christopher Creutzig 2014년 8월 29일
Please provide the values for a, b, c, d with which you run into that problem.
Note that these solution formulas are well known to be numerically unstable. That may be the root of your problem. (No pun intended.)

댓글을 달려면 로그인하십시오.

채택된 답변

Star Strider
Star Strider 2014년 8월 20일
Maybe I’m missing something, but why use the Symbolic Math Toolbox at all for this?
Use the roots function instead:
x = roots([a b c d])

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by