I have this nonlinear system to solve,
phi1=((A1)/(1-K(1,1)*A1)^2)*(1+((V(1,1)*KAB*B1)/(V(2,1)*(1-K(2,1)*B1))));
phi2=((B1)/(1-K(2,1)*B1)^2)*(1+((KAB*A1)/(1-K(1,1)*A1)));
With some help, I started to solve with fsolve, but I need A1 and B1 between 0 and 1.
I tried to put this in lsqnonlin, but it is not working.
Could somebody help me to solve this? What I have to do to have values between 0 and 1?
Is this the better way to solve this system?
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [phi] = Test
V=[18.068;55.918];
K=[1005;213.2];
KAB=50;
phi1=[0.121;0.214;0.341;0.423;0.512;0.611;0.731;0.834;0. 925];
%phi2=1-phi1;
n=numel(phi1);
%f1=-phi1+((A1)/(1-K(1,1)*A1)^2)*(1+((V(1,1)*KAB*B1)/(V(2,1)*(1-K(2,1)*B1))));
%f2=-phi2+((B1)/(1-K(2,1)*B1)^2)*(1+((KAB*A1)/(1-K(1,1)*A1)));
for i = 1:n;
phi1_scal = phi1(i);
phi2_scal = 1 - phi1(i);
F = @(C)
[-phi1_scal+(C(1)/(1-K(1,1)*C(1))^2)*(1+((V(1,1)*KAB*C(2))/(V(2,1)*(1-K(2,1)*C(2)))));-phi2_scal+(C(2)/(1-K(2,1)*C(2))^2)*(1+
((KAB*C(1))/(1-K(1,1)*C(1))))];
InitialGuess = [0.1;0.1];
Options = optimset('Display','iter');
XY = lsqnonlin(F,InitialGuess,0,1,Options)
TP(1,i) = XY(1);
TP(2,i) = XY(2);
phi=TP';
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%