elMentat
elMentat

Reputation: 196

Solving system of equations symbolically

Attempting to solve a system of 8 equations symbolically. I have more than 8 variables, but for all but 8 of them, I have solved them elsewhere. I am specifically trying to find the symbolic solution to one of the variables.

In Mathematica:

In[1]
eqn1 = (T1 - Tc)/(R1 + R2) == i1;
eqn2 = (Tc - V1 + V2 - Th)/R3 == i1;
eqn3 = i1 + i2 + i3 == i4;
eqn4 = (Th - THE)/R3 == i4;
eqn5 = (THE - Tf)/R4 == ifluid;
eqn6 = (THE - Ta)/R5 == ia;
eqn7 = i4 == ifluid + ia;
eqn8 = Th - Tc == dT;

In[2]
Solve[{eqn1, eqn2, eqn3, eqn4, eqn5, eqn6, eqn7, eqn8}, {ifluid}]
Out[2]
{}

Similarly in Matlab:

syms T1 TC TH THE TF TA dT
syms R1 R2 R3 R4 R5 R6
syms V1 V2
syms i1 i2 i3 i4 iF ia

eqn1 = (T1-TC)/(R1+R2) == i1;
eqn2 = (TC-V1+V2-TH)/R3 == i1;
eqn3 = i1+i2+i3 == i4;
eqn4 = (TH-THE)/R4 == i4;
eqn5 = (THE-TF)/R5 == iF;
eqn6 = (THE-TA)/R6 == ia;
eqn7 = i4 == iF+ia;
eqn8 = TH-TC == dT;

eqns = [eqn1,eqn2,eqn3,eqn4,eqn5,eqn6,eqn7,eqn8];

sol = solve(eqns,iF)

output:

sol =

Empty sym: 0-by-1

Can someone point me to what I am doing wrong, or another way to simply go about this?

Upvotes: 1

Views: 236

Answers (1)

Mendi Barel
Mendi Barel

Reputation: 3677

Try this:

syms T1 TC TH THE TF TA dT real
syms R1 R2 R3 R4 R5 R6 real
syms V1 V2 real
syms i1 i2 i3 i4 iF ia real

eqn1 = (T1-TC)/(R1+R2) == i1;
eqn2 = (TC-V1+V2-TH)/R3 == i1;
eqn3 = i1+i2+i3 == i4;
eqn4 = i4==(TH-THE)/R4 ;
eqn5 = (THE-TF)/R5 == iF;
eqn6 = (THE-TA)/R6 == ia;
eqn7 = iF == ia-i4;
eqn8 = TH-TC == dT;

eqns = [eqn1,eqn2,eqn3,eqn4,eqn5,eqn6,eqn7,eqn8];

params1=[iF i1 i2 i3 i4 ia V1 V2 R1 R2 R3 R4 R5 R6 T1 TC TH THE TF TA dT];
Y1 = solve(eqns,params1,'IgnoreAnalyticConstraints',true,'ReturnConditions',1)
Y1.iF
Y1.parameters
Y1.conditions

params2=[iF i1 i2 i3 i4  TH TF TA dT];
Y2 = solve(eqns,params2,'IgnoreAnalyticConstraints',true,'ReturnConditions',1)
Y2.iF
Y2.parameters
Y2.conditions

I don't fully understand whats going on. but it give you the solution.

Upvotes: 1

Related Questions