Plotting bacterial growth curve with ODEs - 'too many input arguments' error

3 views (last 30 days)
I'm supposed to be modelling the growth of 3 bacterial cultures, using growth rates (r) and carrying capacities calculated (K) from our data. The ODEs should take the form: r*P*(1- (P/K))
  • My ODEs are:
*function gODE = f (t, a, b, c, d, e, g, z)
  • gODE = [ a*y(1)* (z - (y(1)/d)), b*y(2)* (z - (y(2)/e)), c*y(3)* (z - (y(3)/g)); ]
and I get the error: Error using gODE Too many input arguments.
Error in odearguments (line 88) f0 = feval(ode,t0,y0,args{:}); % ODE15I sets args{1} to yp0.
Error in ode15s (line 149) [neq, tspan, ntspan, next, t0, tfinal, tdir, y0, f0, odeArgs, odeFcn, ...
Error in growth (line 28) [t,y]=ode15s(@gODE, [0 127200], [r0 s0 u0 ],'', a, b, c, d, e, g, z);
  • I've attached both my ODE file and the code I used to run it to this post.
Hoping someone can help me make this run. Thank you

Accepted Answer

Walter Roberson
Walter Roberson on 27 Jan 2014
[t,y]=ode15s(@(t,y) gODE(t, y, a, b, c, d, e, g, z), [0 127200], [r0 s0 u0 ],'');
and change your function to
gODE = @(t, y, a, b, c, d, e, g, z) [a*y(1)* (z - (y(1)/d)); b*y(2)* (z - (y(2)/e)); c*y(3)* (z - (y(3)/g))];

More Answers (0)

Community Treasure Hunt

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

Start Hunting!