fsolve error using trustnleqn (line 28)
Show older comments
Hello everyone,
I'm trying to solve non linear equations system using fsolve. I'm beginner in matlab I just have no idea what's going on with my program when I tried to run it, there's an error message in the command window:
Error using trustnleqn (line 28)
Objective function is returning undefined values at initial point. FSOLVE cannot continue.
Error in fsolve (line 408)
trustnleqn(funfcn,x,verbosity,gradflag,options,defaultopt,f,JAC,...
Error in singletray (line 10)
x = fsolve(fun,x0);
what does that mean? and what am I supposed to do to get it solved?
here is the function file:
function F = equilibrium(x)
rec_a=0.7;
rec_b=0.9;
HCOin=1.72e-8;
HSin=0.1128;
a=(1-rec_a)*HCOin;
b=(1-rec_b)*HSin;
F(1)=x(1)*a/(x(2)*x(3)) - 32.1421;
F(2)=x(1)*b/(x(2)*x(4)) - 16.7567;
F(3)=x(5)/(a*x(6)) - 3.508e-13;
F(4)=x(1)*x(6)/x(2) - .32134475;
F(5)=x(7)/(x(8)*x(9)) - 2.246e10;
F(6)=x(9)*x(6) - 7.573e-11;
F(7)=x(1)+x(9)+x(7)-b-a-2*x(5)-x(6);
F(8)=2.93-x(8)-x(7);
F(9)=28.27-x(2)-x(1);
end
I run it in :
%Reactive desorption modeling
%assumption: isothermal & only 1 tray
clc;
clear;
%solving 7 unknowns
options = optimoptions('fsolve','Display','iter');
[x,fval] = fsolve(@equilibrium,[0;0;0;0;0;0;0;0;0],options);
Any help would be appreciated. Thank you so much
Accepted Answer
More Answers (0)
Categories
Find more on Random Number Generation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!