Growth kinetics ODE 15
Mostrar comentarios más antiguos
I am trying to simulate a growth kinetics experience however I am constantly getting this error for my functions, any idea of how to solve it? I attached the function, script and error. Thank you!
function dx=odesys(t,x,var)
var[]
%Rate equations
l=0.001;
Io=125e-6;
Il=Io*exp(-sigma*x*l);
mux=mumax*(x(3)/(x(3)+Kxs+((x(3)).^2)/Kixs))*(x(4)/(x(4)+Kxn+((x(4)).^2)/Kixn))*(Il/(Il+Kxl+(Il.^2/Kixl)));
mul=qlmax*(x(3)/(x(3)+Kls+((x(3)).^2)/Kils))*(Kinl/(x(4)+Kinl)*(Il/(Il+Kli+(Il.^2/Kili))));
%ODE
dx(1)=mux.*x(1);
dx(2)=mul.*x(1);
dx(3)=(-(1/Yxs)*dx(1))-((1/Yls)*dx(2));
dx(4)=(-(1/Yxn)*dx(1));
dx(5)=(k1*(x(3)/(x(3)+Kgas))*(x(4)/(x(4)+Kgan+((x(4)).^2))/Kigan));
dx(6)=(k2*(x(3)/x(3)+Kfas)*(x(4)/x(4)+Kfan));
dx(7)=-Kh*(dx(3));
% The function return value is always a vector length equal to number of
% equations in model, and has to be a column vector
dx=dx';
end
Script:
clear all
clc
int=[0.001;0;2.1;0.098;0;0;7];
%Time span to solve ODE
tspan=[0 120];
options=[];
var=[0.227;0.050;9.923;0.065;0.5;0.121;6.554;0.110;380.023;1.47;6.883;0.879;0.064;19.519e-6;2053.924e-6;15.023e-6;2152.918e-6;34.104;0.329;1.456;12.976;2.533;1.4055;12.976;2.533];
%Using ODE 15 to solve system
[t,X]=ode15s(@odesys,tspan,int,options,var);
Errors:
Unable to perform assignment because the indices on the left side are not compatible with the size of the right side.
Error in odesys (line 46)
dx(1)=mux.*x(1);
Error in odearguments (line 90)
f0 = feval(ode,t0,y0,args{:}); % ODE15I sets args{1} to yp0.
Error in ode15s (line 150)
odearguments(FcnHandlesUsed, solver_name, ode, tspan, y0, options, varargin);
Error in script (line 14)
[t,X]=ode15s(@odesys,tspan,int,options,var);
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Ordinary Differential Equations en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!