5 equations, 5 unknowns using fsolve; with scientific variables

5 ビュー (過去 30 日間)
Kaushal
Kaushal 2023 年 11 月 26 日
編集済み: David Goodmanson 2023 年 11 月 27 日
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 件のコメント
Walter Roberson
Walter Roberson 2023 年 11 月 26 日
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.
John D'Errico
John D'Errico 2023 年 11 月 26 日
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?

サインインしてコメントする。

回答 (1 件)

David Goodmanson
David Goodmanson 2023 年 11 月 27 日
編集済み: David Goodmanson 2023 年 11 月 27 日
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 件のコメント
Walter Roberson
Walter Roberson 2023 年 11 月 27 日
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 = 

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeConversion Between Symbolic and Numeric についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by