Error in ode45 (line 107)
Hello, I’m trying to model the biomass accumulation over time of a microorganism that depends on temperature using a differential equation that I want to solve with ode45 function. But I got this error message:
Error using odearguments
@(TIME,XI)DXDT(TIME,XI,TEMP,PARAM,PARAM_PH,PH) returns a vector of length 29613, but the length of initial conditions vector is 1. The vector returned by
@(TIME,XI)DXDT(TIME,XI,TEMP,PARAM,PARAM_PH,PH) and the initial conditions vector must have the same number of elements.
Error in ode45 (line 107)
odearguments(odeIsFuncHandle,odeTreatAsMFile, solver_name, ode, tspan, y0, options, varargin);
After checking, I figured out that the ode45 function doesn’t take my temperature vector but only one cell of it (knowing that the size of my temperature and time vectors is the same).
Can you help me out to solve this issue please?
Here is my code for ode45:
tspan = Time; %Time vector with the same length as experimental data
%C0 is the initial biomass concentration
%the vector param contains my parameters [tmin,topt,tmax,mumax]
[t,xi] = ode45(@(t,xi) dxdt(t,xi,temperature,param),tspan,C0, odeset(‘RelTol’,1E-3));
Here is my dfunction to calculate the ifferential equation:
function dC=dxdt(t,C,Temp,param,param_ph,pH)
dC=C.*phi(param,Temp);
end
Thanks in advance for you help :)Hello, I’m trying to model the biomass accumulation over time of a microorganism that depends on temperature using a differential equation that I want to solve with ode45 function. But I got this error message:
Error using odearguments
@(TIME,XI)DXDT(TIME,XI,TEMP,PARAM,PARAM_PH,PH) returns a vector of length 29613, but the length of initial conditions vector is 1. The vector returned by
@(TIME,XI)DXDT(TIME,XI,TEMP,PARAM,PARAM_PH,PH) and the initial conditions vector must have the same number of elements.
Error in ode45 (line 107)
odearguments(odeIsFuncHandle,odeTreatAsMFile, solver_name, ode, tspan, y0, options, varargin);
After checking, I figured out that the ode45 function doesn’t take my temperature vector but only one cell of it (knowing that the size of my temperature and time vectors is the same).
Can you help me out to solve this issue please?
Here is my code for ode45:
tspan = Time; %Time vector with the same length as experimental data
%C0 is the initial biomass concentration
%the vector param contains my parameters [tmin,topt,tmax,mumax]
[t,xi] = ode45(@(t,xi) dxdt(t,xi,temperature,param),tspan,C0, odeset(‘RelTol’,1E-3));
Here is my dfunction to calculate the ifferential equation:
function dC=dxdt(t,C,Temp,param,param_ph,pH)
dC=C.*phi(param,Temp);
end
Thanks in advance for you help 🙂 Hello, I’m trying to model the biomass accumulation over time of a microorganism that depends on temperature using a differential equation that I want to solve with ode45 function. But I got this error message:
Error using odearguments
@(TIME,XI)DXDT(TIME,XI,TEMP,PARAM,PARAM_PH,PH) returns a vector of length 29613, but the length of initial conditions vector is 1. The vector returned by
@(TIME,XI)DXDT(TIME,XI,TEMP,PARAM,PARAM_PH,PH) and the initial conditions vector must have the same number of elements.
Error in ode45 (line 107)
odearguments(odeIsFuncHandle,odeTreatAsMFile, solver_name, ode, tspan, y0, options, varargin);
After checking, I figured out that the ode45 function doesn’t take my temperature vector but only one cell of it (knowing that the size of my temperature and time vectors is the same).
Can you help me out to solve this issue please?
Here is my code for ode45:
tspan = Time; %Time vector with the same length as experimental data
%C0 is the initial biomass concentration
%the vector param contains my parameters [tmin,topt,tmax,mumax]
[t,xi] = ode45(@(t,xi) dxdt(t,xi,temperature,param),tspan,C0, odeset(‘RelTol’,1E-3));
Here is my dfunction to calculate the ifferential equation:
function dC=dxdt(t,C,Temp,param,param_ph,pH)
dC=C.*phi(param,Temp);
end
Thanks in advance for you help 🙂 error in ode45 (line 107) MATLAB Answers — New Questions