Error using odearguments (line 95) returns a vector of length 2, but the length of initial conditions vector is 3. The vector returned by function and the initial conditions vector must have the same number of elements.
55 views (last 30 days)
I am trying to make a couple of graphs with ODE functions, but it happens that I want to add 0.1 intervals to the graph from 0.001 to 1 but it shows the following error:
Error using odearguments (line 95)
CLASE2 returns a vector of length 2, but the length of initial conditions vector is 3. The vector returned by CLASE2 and
the initial conditions vector must have the same number of elements.
This is my function:
function dydt = clase2 (t,y)
u = (umax*X)/(Kss+S);
dXdt = (u*X)-(Di*X);
dSdt = ((-Kso*S*X)/(Kso1+S))-(Di*S)+(Di*Sen);
dydt = [dXdt dSdt]';
This is my script:
[t,x] = ode23('clase2',[0, 80],[0.001 0.01 1]);
Di = 0.001;
Steven Lord on 2 Nov 2019
Are you trying to control the times at which ode23 returns the solutions of your ODEs to make them more finely spaced? If so, don't change the initial condition vector. Change the tspan input instead, specifying a vector with more than two elements. If you had called ode23 with one output instead of two, you could have used the deval function to evaluate that existing solution at a different set of times.