Monod equations with ODE45
显示 更早的评论
Hello, I am new to matlab and I would like to know what error I have in my differential equations, I need to print the results graphically, where xt0 = 0.3660,225,0.00 please help
umax = 0.313;
ksp = 28.39;
ks = 47.51;
Yxs = 0.48;
Yxp = 0.50;
kis = 308.13;
kip = 299.67;
Pxmax = 83.35;
Ppmax = 107.79;
m = 0.001;
qmax = 3.69;
alfa = 1.53;
Pi = 0;
n = 1.53;
D = 0.10;
xi = 0.3660;
Si = 225;
%a(1) = x
%a(2) = s
%a(3) = p
f = @(t,a) [(D*xi-a(1))*((umax*(a(2))/((ks)+(a(2))+(a(2)^2/(kis))))*(1-(a(3))/((Pxmax))^alfa)-D); -(1/Yxs)*(D*xi-a(1))*((umax*(a(2))/((ks)+(a(2))+(a(2)^2/(kis))))*(1-(a(3))/((Pxmax))^alfa)-D)-(1/Yxp)* (D*(Pi-a(3)))+ (a(1)*(qmax*(a(2))/((ksp)+(a(2))+(a(2)^2/(kip)))))*((1-(a(3))/(Ppmax))^n)-(m*a(1))-(D*(Si+a(2)));(D*(Pi-a(3)))+ (a(1)*(qmax*(a(2))/((ksp)+(a(2))+(a(2)^2/(kip)))))*((1-(a(3))/(Ppmax))^n)];
xt0 = [0.3660,225,0.00];
[tspan,a] = ode45(f,[0 300],xt0);
plot(tspan,a(:,1),tspan,a(:,2),tspan,a(:,3))
title('Andrews*Levenspiel (Si = 225/L)')
xlabel('Tiempo en hrs')
ylabel('Biomasa (X), Sustrato (S), Producto(P)')
hold off

回答(1 个)
Bjorn Gustavsson
2020-12-14
From the looks of your 3 coupled ordinary differential equations it seems unlikely that they have solutions that are neat elementary analytical functions. The easiest way to go about this problem then is to integrate them numerically. For that you should write one function that defines the three equations for dS/dt, dX/dt and dP/dt, and then use ode45 (or one of its siblings) to integrate that function from your initial conditions. See the help and documentation to ode45.
The ode-function should look something like this:
function dSdtdXdtdPdt = your3odes(t,SXP,other_pars)
D = other_pars(1);
Xi = other_pars(2);
Pi = other_pars(3);
% etc...
S = SXP(1);
X = SXP(2);
P = SXP(3);
dPdt = D*(Pi-P) + %the rest of that equation
dXdt = D*Xi - X* % the rest f that equation
dSdt = % same here
% Combine the 3 time-derivatives into one column-array
dSdtdXdtdPdt = [dSdt;dXdt;dPdt];
end
Then integrate that over your time-span of interest from your initial conditions [S0;X0;P0].
HTH
类别
在 帮助中心 和 File Exchange 中查找有关 Ordinary Differential Equations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!