How I should make a loop for coefvct's roots?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Nima Izadyar
am 20 Aug. 2019
Beantwortet: Divya Yerraguntla
am 27 Aug. 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.
0 Kommentare
Akzeptierte Antwort
Divya Yerraguntla
am 27 Aug. 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!
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!