# I have two equations that are difficult to solve, so I am using fsolve to get the sol. But while running the program I encountered the error .Please help me or tell other way to solve these equations.

1 view (last 30 days)
Dhanvir Singh on 6 Apr 2019
Commented: Walter Roberson on 11 Dec 2019
first equ;
F1- (0.41*f1^2 + f1(1-f1))/(0.41*f1^2 + 2*f1(1-f1) +0.04*(1-f1)^2)=0
second equ;
0.589/(0.589 - 31.71/(104-51*F1)) - ((2826*4.479*E-7)*(176*62500*f1^2 + 2*62500*429.27*f1 - 2*62500*429.27*f1^2 + 2500*429.27 + 2500*429.27*f1^2 - 2*2500*429.27*f1))/(429.27*(1-f1) + 62500*f1) -1
;
program;;;;
function fcns = eqs(z)
F1 = z(1);
f1 =z(2);
fcns(1) = F1- (0.41*f1^2 + f1(1-f1))/(0.41*f1^2 + 2*f1(1-f1) +0.04*(1-f1)^2);
fcns(2) = 0.589/(0.589 - 31.71/(104-51*F1)) - ((2826*4.479*E-7)*(176*62500*f1^2 + 2*62500*429.27*f1 - 2*62500*429.27*f1^2 + 2500*429.27 + 2500*429.27*f1^2 - 2*2500*429.27*f1))/(429.27*(1-f1) + 62500*f1) -1 ;
end
guess =[0.28 0.0244 ];
result = fsolve(@eqns,guess)
Dhanvir Singh on 6 Apr 2019
error;;
fsol
Array indices must be positive integers or logical values.
Error in eqs (line 4)
fcns(1) = F1- (0.41*f1^2 + f1(1-f1))/(0.41*f1^2 + 2*f1(1-f1) +0.04*(1-f1)^2);
Error in fsolve (line 242)
fuser = feval(funfcn{3},x,varargin{:});
Error in fsol (line 2)
result = fsolve(@eqs,guess)
Caused by:
Failure in initial objective function evaluation.
FSOLVE cannot continue.

madhan ravi on 6 Apr 2019
Edited: madhan ravi on 6 Apr 2019
guess = [0.28 0.0244];
result = fsolve(@eqs,guess)
function fcns = eqs(z)
F1 = z(1);
f1 = z(2);
fcns(1) = F1- (0.41*f1^2 + f1*(1-f1))/(0.41*f1^2 + 2*f1*(1-f1) +0.04*(1-f1)^2);
fcns(2) = 0.589/(0.589 - 31.71/(104-51*F1)) - ((2826*4.479*1E-7)*(176*62500*f1^2 + 2*62500*429.27*f1 - 2*62500*429.27*f1^2 + 2500*429.27 + 2500*429.27*f1^2 - 2*2500*429.27*f1))/(429.27*(1-f1) + 62500*f1) -1 ;
end
##### 2 CommentsShowHide 1 older comment
madhan ravi on 7 Apr 2019
Not true, guess should in the proximity of the possible solutions.

Alex Sha on 11 Dec 2019
there are two solutions:
1:
F1: 0.458069398988435
f1: -1.13829069933547
2:
F1: 0.280093672719386
f1: 0.0244403974479464
Walter Roberson on 11 Dec 2019
f1 is the four roots of
z^4 - (6077732260096151484325981836*z^3)/48676678745197603497996139375 - (2441998460292700770357164693701*z^2)/1703683756081916122429864878125 + (9739486432015774348021785204*z)/1703683756081916122429864878125 + 1223147048303704354962394632/1703683756081916122429864878125
F1 is related as
(340407827229812874745643267503*f1.^2)/2191837914062353460625 - (20253838448*f1.^3)/19 + (39001068488315423891730831977796*f1)/25571442330727457040625 - 955175915804501125862716674706/25571442330727457040625