Solving 8 equations with 8 unknowns using FSOLVE

11 views (last 30 days)
I have 8 equations with 8 unknowns as shown bellow. please how can I solve them and find the unkowns. I tried FSOLVE coding and it showed an error (Error using fsolve (line 298). Objective function is returning undefined values at initial point. FSOLVE cannot continue.). So, please could you help me to find the issue.
function F = radwan(x)
jw1=1.787;
jw2=3.0375;
DHv=2257; %kj/kg (40.65 kj/mol)
Tbf1=35;
Tbf2=45.6;
Tbp1=10.9;
Tbp2=12.7;
Q1=17000.763;
Q2=26000.778;
C1=0.680046641;
C2=0.754098;
hm1=1;
hm2=1;
F(1)=x(1)*(Tbf1-x(2))-Q1;
F(2)=hm1*(x(2)-x(3))+jw1*DHv-Q1;
F(3)=x(4)*(x(3)-Tbp1)-Q1;
F(4)= x(5)*(Tbf2-x(6))-Q2;
F(5)=hm2*(x(6)-x(7))+jw2*DHv -Q2;
F(6)=x(8)*(x(7)-Tbp2)-Q2;
F(7)=C1*((exp(-6.4313+(1882/x(2)))/exp(-6.4313+(1882/x(6))))^0.14)-(x(5)/x(1));
F(8)=C2*((exp(-6.4313+(1882/x(3)))/exp(-6.4313+(1882/x(7))))^0.14)-(x(8)/x(4));

Accepted Answer

Walter Roberson
Walter Roberson on 10 Dec 2020
you have divisions by x1, x2, x3, x4, x6, and x7. Your code would fail if the initial values for any of those are 0.
  2 Comments
Matt J
Matt J on 10 Dec 2020
Edited: Matt J on 10 Dec 2020
Or, rewrite the final equations as,
F(7)=x(1)*C1*((exp(-6.4313+(1882/x(2)))/exp(-6.4313+(1882/x(6))))^0.14)-x(5);
F(8)=x(4)*C2*((exp(-6.4313+(1882/x(3)))/exp(-6.4313+(1882/x(7))))^0.14)-x(8);
Alex Sha
Alex Sha on 10 Dec 2020
Matt's suggestion is an effective method,If doing like that, there will be multi-solutions:
1:
x1: 152.742230393022
x2: -76.3036188895187
x3: -13043.8076188895
x4: -1.30227068244721
x5: 3.40351026683942
x6: -7593.80048993739
x7: -26738.9409899374
x8: -0.971932077354813
fevl:
-1.81898940354586E-11
-1.81898940354586E-11
1.81898940354586E-11
7.27595761418343E-12
1.09139364212751E-11
2.5465851649642E-11
-3.99680288865056E-15
3.59712259978551E-14
2:
x1: 0.53037478392545
x2: -32019.2444989045
x3: -44986.7484989045
x4: -0.377814476247884
x5: 0.359028482663491
x6: -72374.2197510973
x7: -91519.3602510973
x8: -0.284061977067628
fevl:
1.81898940354586E-11
0
-1.09139364212751E-11
-1.09139364212751E-11
-3.63797880709171E-12
-5.45696821063757E-11
-3.17379456049594E-12
-6.14297501755345E-12

Sign in to comment.

More Answers (0)

Categories

Find more on Physics in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!