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!