How I should make a loop for coefvct's roots?
1 次查看(过去 30 天)
显示 更早的评论
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.
0 个评论
采纳的回答
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 个评论
更多回答(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!