ode45 error problem in following code

조회 수: 4 (최근 30일)
em246
em246 2019년 1월 14일
댓글: em246 2019년 1월 14일
I'm receiving errors for the following code:
mumax = 0.20;
Ks = 2;
Yxs = 0.58;
Ypx = 0.2;
Sf = 0.37;
Kp= 97.9;
mu = @(S,P) mumax*S./(Ks + S)*(1 - (P/Kp))^0.5; % Monod Equation
rg = @(X,S) mu(S)*X; % Rate of cell growth
rp = @(X,S) Ypx*rg(X,S); % Rate of product formation
F = @(t) 0.05;
dXV = @(t, x) x(4) *rg(x(1), x(2));
dPV = @(t, x) x(4) *rp(x(1), x(2));
dSV = @(t,x) F(t)*Sf - x(4)*rg(x(1), x(2))/Yxs;
dV = @(t,x) F(t);
dX = @(t,x) (dXV(t,x) - x(1)*dV(t,x))/x(4);
dS = @(t,x) (dSV(t,x) - x(2)*dV(t,x))/x(4);
dP = @(t,x) (dPV(t,x) - x(3)*dV(t,x))/x(4);
f = @(t,x) [dX(t,x); dS(t,x); dP(t,x); dV(t,x)];
tspan = [0 100];
[t,x] = ode45(f,tspan,ic);
The error I receive is:
Not enough input arguments.
Error in @(S,P)mumax*S./(Ks+S)*(1-(P/Kp))^0.5
Error in @(X,S)mu(S)*X
Error in @(t,x)x(4)*rg(x(1),x(2))
Error in @(t,x)(dXV(t,x)-x(1)*dV(t,x))/x(4)
Error in @(t,x)[dX(t,x);dS(t,x);dP(t,x);dV(t,x)]
Error in odearguments (line 90)
f0 = feval(ode,t0,y0,args{:}); % ODE15I sets args{1} to yp0.
Error in ode45 (line 115)
odearguments(FcnHandlesUsed, solver_name, ode, tspan, y0, options, varargin);

채택된 답변

madhan ravi
madhan ravi 2019년 1월 14일
doc ode45 % please read the documentation

추가 답변 (1개)

Steven Lord
Steven Lord 2019년 1월 14일
mu = @(S,P) mumax*S./(Ks + S)*(1 - (P/Kp))^0.5; % Monod Equation
rg = @(X,S) mu(S)*X; % Rate of cell growth
As defined mu is a function of both S and P. Your rg function attempts to call it with just S. What value should be passed into mu as its second input when rg gets called?
  댓글 수: 3
Steven Lord
Steven Lord 2019년 1월 14일
If I asked you to add two numbers x and y together and told you that x was 1, what's the answer? Do you have enough information to answer that question?
em246
em246 2019년 1월 14일
Apologies, I forgot to include this in the thread but I have defined the variables as below:
%x(1) X Cell Concentration 0.01
%x(2) S Substrate Concentration 0.38
%x(3) P Product Concentration 0
%x(4) V Volume 30

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by