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

1 vue (au cours des 30 derniers jours)
Nima Izadyar
Nima Izadyar le 20 Août 2019
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.

Réponse acceptée

Divya Yerraguntla
Divya Yerraguntla le 27 Août 2019
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!

Plus de réponses (0)

Catégories

En savoir plus sur Loops and Conditional Statements dans Help Center et File Exchange

Produits


Version

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by