5 equations, 5 unknowns using fsolve; with scientific variables

Hi, I have been facing an issue with solving these five equations, and figuring out the five uknonws associated with these five equations. To start with, I equated each of the equations to zero; and then made them into functions. I am lost as how to move forward. If someone, could guide me, or start from scratch with how it should be done, I would really appreciate it.

3 comentarios

You have 6 equations in 16 unknowns. Also, T_4 does not appear anywhere in your equations.
syms a_c_ATPS a_heater_ATPS
syms cp_fluid
syms h_fluid
syms k_fluid
syms L_c_ATPS
syms m_dot
syms p_ATPS_surface
syms q
syms T_2 T_3 T_avg T_fluid_ATPS_inlet T_fluid_output_ATPS Ts_1
syms w_ATPS
Your f(2) and your f(4) both have a sub-expression which is (1) which is suspect. If you need to have something of the form A/1/(B*C) then code it as A*(B*C) or A*B*C .
Note that none of the public releases of MATLAB are able to execute images of code... and very very few of the volunteers are motivated to type in expressions that long.
It is just as easy to paste in actual text, instead of a picture of your code. I will assert that is is going to take some effort to copy your code line by line, and get a valid copy. So that means the set of people willing to help you will be small.
Is there a good reason why you want to make it more difficult to get help?

Iniciar sesión para comentar.

Respuestas (1)

David Goodmanson
David Goodmanson el 27 de Nov. de 2023
Editada: David Goodmanson el 27 de Nov. de 2023
Hi Kaushal,
looks like 6 eqns 6 unknowns not 5. All of your unknowns appear in the numerators of the given expressions and no products of unknowns occur, so it looks like a set of linear equations which is easy to solve. Whether they are long or short I don't think it helps comprehension to have variables full of underlines; for example in a set of equations, I think T2 is easier to read than T_2 and I will use tfoA in place of t_fluid_outlet_ATPS. The the six equations have the form (t involves less keyboard strokes than T)
(ts1 -t2)*c1 -q = 0
(t2 -tavg)*c2 -q = 0
c3 + q*c4 - tavg = 0
(tavg -t3)*c5 -q = 0
(t3 -t4)*c6 -q = 0
c7*(tfoA -c8) -q = 0
where the constants are various combinations of known quantities that you can calculate.
If you create a column vector of unknowns with
X = [q t2; t3; t4; tavg; tfoA] % semicolons create a column vector
and a column vector of all the known constant terms put over to the right hand side where the zeros are:
Y = [-c1*ts1; 0; -c3; 0; 0; c7*c8]
then this can be put into matrix multiplication form
MX = Y with
[-1 -c1 0 0 0 0 [q] [-c1*ts1]
-1 c2 0 0 -c2 0 [t2] [0 ]
M = c4 0 0 0 -1 0 x [t3] = [-c3 ]
-1 0 -c5 c5 0 0 [t4] [0 ]
-1 0 c6 -c6 0 0 [tavg] [0 ]
-1 0 0 0 0 c7] [tfoA] [c7*c8 ]
You can pretty much read off the six eqns.
The solution to MX = Y is found with the backslash command.

1 comentario

Personally, I have gotten into the habit of using underscores more because when I am using symbolic variables in LiveScript (or here on MATLAB Answers) then the underscores and what follows are processed to render as subscripts or superscripts or accents.
syms a a_2 a__2 a_bar a__bar a_dot a__dot a_ddot a__ddot
[a a_2 a__2 a_bar a__bar a_dot a__dot a_ddot a__ddot]
ans = 

Iniciar sesión para comentar.

Etiquetas

Preguntada:

el 26 de Nov. de 2023

Editada:

el 27 de Nov. de 2023

Community Treasure Hunt

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

Start Hunting!

Translated by