Solve with a vector of coefficients

2 ビュー (過去 30 日間)
Rafael Ibáñez
Rafael Ibáñez 2019 年 2 月 25 日
コメント済み: Rafael Ibáñez 2019 年 2 月 26 日
I want to obain the positive roots or a polynomial like
fun= x^3+ A*x^2 + B *x + D==0
h = single(solve(fun,x));
h=h(h>0);
Both A and B coefs are function of the same parameter (V)
A= vb/2
b=vb^2
and vb is defined as a vector
vb= linspace(0,100,101)
I want to obtain a vector (p)with the solutions in ordet to plot
plot (vb,p)
I've tried with loops (for and while) but both are too slow.
There is another way to do that?

採用された回答

Stephan
Stephan 2019 年 2 月 25 日
編集済み: Stephan 2019 年 2 月 25 日
Hi,
if i assume that you do not do symbolic calculations and you have values for D, then for this purpose there is the roots function, which should be much faster than solve in this case.
Best regards
Stephan
  1 件のコメント
Rafael Ibáñez
Rafael Ibáñez 2019 年 2 月 26 日
Solved.
Thank you

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

その他の回答 (0 件)

カテゴリ

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

タグ

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by