フィルターのクリア

Want to use 'solve' with non symbolic variables

19 ビュー (過去 30 日間)
Chris
Chris 2011 年 9 月 30 日
Lets say I had the equation:
ax^2+bx+c=0 (the real one is more complicated) and I wanted to get numeric solutions for x with given values of a b & c, but these values change constantly in the program. How could I use solve for this.
Thanks,
Chris

採用された回答

Walter Roberson
Walter Roberson 2011 年 9 月 30 日
syms a b c
soln = matlabFunction(solve(a*x^2+b*x+c,x), 'vars', [a b c]);
Now call soln() passing in your numeric values for a, b, and c.
Warning: watch out for the fact that solve() might return multiple solutions!
  1 件のコメント
Chris
Chris 2011 年 9 月 30 日
That works great, thank you for your help

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeNumeric Solvers についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by