How I should make a loop for coefvct's roots?

1 回表示 (過去 30 日間)
Nima Izadyar
Nima Izadyar 2019 年 8 月 20 日
回答済み: Divya Yerraguntla 2019 年 8 月 27 日
I am trying to calculate the following formula using Matlab:
x = 34.704 - 0.34 * 10^-8 * [(x+273)^4-(r+273)^4] + 1.1 * h * (x - T)
h= 2.38 * (x - T) ^ 0.25 , for 2.38 (x - T) ^ 0.25 > 12.1 * u ^ 0.5
h= 12.1 * u ^ 0.5 , for 2.38 (x - T) ^ 0.25 < 12.1 * u ^ 0.5
r = ( (G+273)^4 + 2.5 * 10^8 * u^ 0.6 * (G - T) ) ^ 0.25 - 273
G= 0.5 * r + 0.5 * T
i= 1 : 10, and x= (x1, x2, ..., x 10) , r= (r1, r2, ..., r10), h= (h1, h2, ..., h10), T= (T1, T2, ..., T10), u = (u1, u2, ..., u10), G = (G1, G2, ..., G10)
I am trying to find x, which I reckon I should use coefvct for finding roots, but it is complicated to connect x and other parameters.
It would be much appreciated if you could please advice me regarding this matter.

採用された回答

Divya Yerraguntla
Divya Yerraguntla 2019 年 8 月 27 日
Hi Nima,
It is not always necessary to create a coefficient vector and use roots function to solve a polynomial equation. You could use vpasolve function from Symbolic Math Toolbox, which takes in the entire equation as the input argument. Have a look at this link for more information about vpasolve function.
You can have a look at this question, especially its extended questions in comments to create loops to solve equations with changing variables or variable vectors.
Hope it helps!

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

タグ

製品


リリース

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by