Solve system of non-linear equations with parameter in for loop
2 次查看(过去 30 天)
显示 更早的评论
Hello! I am trying to solve a system of nonlinear equations,but for these equations i have a paramater (D) that takes values from 0 to 0.5, and i try to solve the system in afor loop for each D value.
D=0:0.01:0.5;
for i= 1:length(D)
options=optimset('Display','off');
fsol = fsolve(@solutionsproblem,D(i),options)
X(i) = fsol(1)
end
function F=solutionsproblem(x,D)
mm=0.5;
k=0.1;
ktonos=1;
y=0.3;
a=0.2;
sf=2;
F(1)=D-((mm*x(2)*x(1))/(k+x(2))*(1+(x(3)/ktonos)));
F(2)=-D*x(3)+((a*mm*x(2)*x(1))/(k+x(2))*(1+(x(3)/ktonos)));
F(3)=D*(sf-x(2))-(1/y)*((mm*x(2)*x(1))/(k+x(2))*(1+(x(3)/ktonos)));
end
It keeps telling me the following:
Not enough input arguments.
Error in solutionshit (line 10)
F(1)=D-((mm*x(2)*x(1))/(k+x(2))*(1+(x(3)/ktonos)));
Error in fsolve (line 242)
fuser = feval(funfcn{3},x,varargin{:});
Error in ask13pavlou (line 5)
fsol = fsolve(@solutionshit,D(i),options)
Caused by:
Failure in initial objective function evaluation. FSOLVE cannot continue.
What am I missing here? Thanks a lot beforehand!
0 个评论
采纳的回答
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Systems of Nonlinear Equations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!