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 view (last 30 days)
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.

Accepted Answer

Walter Roberson
Walter Roberson on 2 Apr 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 Comments
Walter Roberson
Walter Roberson on 2 Apr 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 );

Sign in to comment.

More Answers (0)

Categories

Find more on Symbolic Math Toolbox in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!