二次方程式の解を求める。

43 visualizzazioni (ultimi 30 giorni)
ryouya saitou
ryouya saitou il 13 Dic 2021
Commentato: ryouya saitou il 14 Dic 2021
現在3次以上の方程式の解を求めたいと思い、計算プログラムを組んでいます。solveという関数を用いた例があったため、これをもちいて2次方程式を解くプログラムを試作したのですが、欲しい解が数値解なのに対しシンボリック解で出力されており困っています。3次以上の方程式で数値解を得られるプログラムの書き方を教えていただきたいです。よろしくお願いします。

Risposte (1)

Atsushi Ueno
Atsushi Ueno il 13 Dic 2021
3次以上でも3次未満でもvpasolve()で数値解(シンボリック値)が得られます。double()で数値になります。
syms x
eqn = 0.01847 * x^2 + 1.161 * x + 11.19 == 0;
S = solve(eqn)
S = 
S = vpasolve(eqn)
S = 
double(S)
ans = 2×1
-50.9730 -11.8856
  1 Commento
ryouya saitou
ryouya saitou il 14 Dic 2021
回答ありがとうございます。
二次方程式、三次方程式にて数値解を得ることが出来ました。
ありがとうございました。

Accedi per commentare.

Categorie

Scopri di più su Symbolic Math Toolbox in Help Center e File Exchange

Prodotti


Release

R2020b

Community Treasure Hunt

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

Start Hunting!