Solving a cubic equation using fsolve

Hi I am a beginner in matlab. I was given in problem to solve a cubic equation using fsolve. The equation is: 0.2456*x^3-2.76*x^2+7.92*x+3=0 whenever i try solving this using fsolve i get that the variable x is undefined.i dont know what im doing wrong. pls help me out.hope for a prompt reply.

回答 (1 件)

Walter Roberson
Walter Roberson 2011 年 3 月 1 日

0 投票

You need to define your equation as a function:
eqn1 = @(x) 0.2456*x^3-2.76*x^2+7.92*x+3
Then you would fsolve(eqn1, x0) where x0 is the initial guess.
See Example 1 in the fsolve documentation

カテゴリ

ヘルプ センター および File ExchangeSystems of Nonlinear Equations についてさらに検索

タグ

質問済み:

2011 年 3 月 1 日

Community Treasure Hunt

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

Start Hunting!

Translated by