How solve a poly?
3 ビュー (過去 30 日間)
古いコメントを表示
Hi, i'm with difficults in solver poly in matlab, for example:
syms x;
fx = x^5 + 2*x^4 + 7*x^3 + 9*x^2 + 8*x - 6
x = 0;
ans = -6
0 件のコメント
回答 (2 件)
Star Strider
2016 年 2 月 26 日
If you want the roots of the polynomial, use the vpasolve function:
syms x
fx = x^5 + 2*x^4 + 7*x^3 + 9*x^2 + 8*x - 6
fx_roots = vpasolve(fx == 0)
fx_roots =
0.44238493070265787278357718736358
- 0.051527066306945417459920042848339 - 2.2932784088204198253304516514344i
- 1.1696653990443835189318685508335 - 1.0997720388236547546840787557965i
- 0.051527066306945417459920042848339 + 2.2932784088204198253304516514344i
- 1.1696653990443835189318685508335 + 1.0997720388236547546840787557965i
2 件のコメント
Star Strider
2016 年 2 月 26 日
編集済み: Star Strider
2016 年 2 月 26 日
Rodrigo Franco’s ‘Answer’ moved here:
Nooo.... I don't want the roots of the function, i want just send values in poly
For example:
syms x
fx = x^5 + 2*x^4 + 7*x^3 + 9*x^2 + 8*x - 6
x = 0;
ans = -6
x = 1
ans = .....
Star Strider
2016 年 2 月 26 日
O.K. If you have R2012a or later, you can create a symbolic funcition:
syms x
f(x) = x^5 + 2*x^4 + 7*x^3 + 9*x^2 + 8*x - 6
f0 = f(0)
f1 = f(1)
f0 =
-6
f1 =
21
Otherwise, use the subs function to get the same result:
fx = x^5 + 2*x^4 + 7*x^3 + 9*x^2 + 8*x - 6
f1 = subs(fx, x, 1)
Image Analyst
2016 年 2 月 26 日
You can get rid of the "syms" line and just define x before fx:
x = 0;
fx = x^5 + 2*x^4 + 7*x^3 + 9*x^2 + 8*x - 6
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Symbolic Math Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!