![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/291951/image.png)
Solving a system of ODEs with additional parameters
3 次查看(过去 30 天)
显示 更早的评论
I'm trying to solve a system of 6 differential equations which need 12 parameters. I would like to use ode23 to solve them. Following scripts show the methodolody I employed included script and function. Does anyone know where the mistake is?
%Evaluation of the diferential equation system with literature parameters.
%Definition of time domain (in hours)
domain=[0 75];
%Definition of parameter values.
P=[0.355,0.983,4.190,15.6,1.23,0.855,0.0016,2.234,199,0.314,11.501,0.0035];
%Definition of initial conditions.
X0=1.49; %g/L
Sn0=2.28; %g/L
Sc0=20; %g/L
P0=0.26; %g/L
mun0=P(1)*((1-Sn0/P(4))^P(10)); %h^-1
muc0=P(1)*((1-Sc0/P(9))^P(5)); %h^-1
IC=[X0,Sn0,Sc0,P0,mun0,muc0];
%Solving the system.
[t,D]=ode23(@(t,D) ode_sys(t,D,P),domain,IC);
function [dDV_dIV] = ode_sys(t,D,P)
%Solves the set of differential equations corresponding to mass balances
% This function calculates X,Sn,Sc,P,mun,muc that depend on time and an
% established set of parameters.
%Asign places in the array for the parameters
mumax=P(1);
alpha=P(2);
Ksc=P(3);
Snm=P(4);
a1=P(5);
yxpsc=P(6);
mc=P(7);
Ksn=P(8);
Scm=P(9);
a2=P(10);
yxsn=P(11);
mn=P(12);
% Asign places in the array for dependent variables
X=D(1);
Sn=D(2);
Sc=D(3);
P=D(4);
mun=D(5);
muc=D(6);
%Create a vector which contains a function in each place
dDV_dIV=zeros(6,1);
dDV_dIV(1)=(mumax*((Sc/(Ksc+Sc))*(Sn/(Ksn+Sn))*(1-(Sc/Scm)^a1)*(1-(Sn/Snm)^a2)))*X;
dDV_dIV(2)=-(((1/yxsn)*mun)+mn)*X;
dDV_dIV(3)=-((1/yxpsc)*muc+mc)*X;
dDV_dIV(4)=(alpha*mu)*X;
dDV_dIV(5)=mumax*(1-(Sn/Snm)^a2);
dDV_dIV(6)=mumax*(1-(Sc/Scm)^a1);
end
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Ordinary Differential Equations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!