필터 지우기
필터 지우기

5 equations, 5 unknowns using fsolve; with scientific variables

조회 수: 4 (최근 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 CenterFile Exchange에서 Number Theory에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by