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 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Dhruv Sangal
el 2 de Abr. de 2017
Comentada: Walter Roberson
el 2 de Abr. de 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 comentarios
Respuesta aceptada
Walter Roberson
el 2 de Abr. de 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 comentarios
Walter Roberson
el 2 de Abr. de 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 );
Más respuestas (0)
Ver también
Categorías
Más información sobre Symbolic Math Toolbox en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!