How to solve mass transfer equation with array input
Mostrar comentarios más antiguos
My bass balance equation for the energy loss of a water tank exposed to the sun is the following: M*c_p*dT/dt = Q, where Q is the sum of the energy loss through convection, evaporation and radiation:
Q_conv = h_c*A*(T_w-T)
Q_evap = m*c_p*(100-T_w)*1000/24/3600
Q_rad = sigma*T_w^4*eps_lent*A+G*eps_lent*A;
Where dT/dt, T and G are arrays. I tried to solve the mass balance for T_w (water temperature) using solve(eqn,T_w) but I only get a symbolic 0x1 matrix as an answer with no content. How do I solve this correctly so that I get an array for T_w?
Best regards
Respuestas (1)
Star Strider
el 18 de Sept. de 2017
1 voto
You appear to have a system of differential equations. You need to correctly cast your system as a set of differential equations (see the documentation on ode45 to begin with), then solve them numerically using one of the ODE solvers, or (if it has an analytic solution), the Symbolic Math Toolbox dsolve function.
It’s not obvious to me what the variables-of-interest are, so I leave the coding to you.
3 comentarios
kwak
el 18 de Sept. de 2017
Star Strider
el 18 de Sept. de 2017
If you already have the vectors for your variables and just want to calculate the result, that should be straightforward, with a little algebra.
Use the element-wise multiplication and division ‘dot operator’, ‘.*’ and ‘./’ unless you want to do matrix calculations. See Array vs. Matrix Operations (link) for details. The Symbolic Math Toolbox is likely not necessary.
Categorías
Más información sobre Programming en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!