Hi, I want to solve a equation for a variable. I am not able to figure out which command should I use to solve it and how.
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Dhruv Sangal
le 2 Avr 2017
Commenté : Walter Roberson
le 2 Avr 2017
The problem is as follows
tauc*alp_g*G*As + Skyemi*eps_g*sig*As*Tsky.^4 - eps_g*sig*As*Tg.^4 - ha*As*(Tg - Tamb) + (T2 - Tg)/((delxr)/(1/(hi*As)+(kroof*As)))
I want to solve for the variable Tg.
0 commentaires
Réponse acceptée
Walter Roberson
le 2 Avr 2017
If you have the symbolic toolbox then you can
syms Tg
and then define the equation and use solve()
Otherwise you can do some minor algebra to expand the equation into a polynomial, and write out the terms from largest to smallest, and use roots() to get numeric solutions.
Note: there will be four solutions but we do not have enough information to know if they will all be real-valued
3 commentaires
Walter Roberson
le 2 Avr 2017
Use
syms Tg nonnegative
Using the previous value would be useful if you were doing a numeric solution using fsolve() or fzero(), but you do not need to use those.
Direct numeric approach:
all_Tg = roots( [As^2*delxr*eps_g*hi*sig, 0, 0, 1+hi*(delxr*ha+kroof)*As^2, -hi*((Skyemi*Tsky^4*eps_g*sig+G*alp_g*tauc+Tamb*ha)*delxr+kroof*T2)*As^2-T2] );
Tg = all_Tg( imag(all_Tg) == 0 & real(all_Tg) >= 0 );
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Symbolic Math Toolbox dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!