Plotting Kinetic Model Monod, Haldane With Parameters
Show older comments
Hello, I want to ask some questions regarding my code (attacthed with name CobaParZhang.m) about plotting graph. When I run the code, it shows error "Index exceeds the number of array elements (1)" like attached bellow.

I would like to plot C(1) (biomass), C(2) (substrate), and C(3) (product) into one figure from these 3 equations below:
, where dX/dt = miu*X
And here are the kinetic parameters:

I am wondering maybe it has some problem with the equation that I am using or the inconsistent unit (biomass and substrate is in g/L, product is in mg/L). Any help or comment or advice about this problem is very welcomed. Thank you so much for your attention.
function CobaParameterZhang
Rentang = linspace(0, 20, 50);
C0 = [0.143; 0.9659; 0.094406];
Miumax=0.5258;
Ks=0.0211;
Kxi=56.6813;
KXI=53.26;
CXm=2.9161;
CPm=55.6192;
Miupx=6.0679;
YPX=20.7502;
KPS=0.0017;
Kpi=63.9593;
KPI=72.5525;
KP=19.1078;
Miusx=1.8216;
YXS=2.6872;
YPS=60.3616;
[t,C]=ode23(@(t,C)ParameterZhang(t,C,Miumax,Ks,Kxi,KXI,CXm,CPm,Miupx,YPX,KPS,Kpi,KPI,KP,Miusx,YXS,YPS),Rentang,C0);
figure
yyaxis left
plot(t,C(:,[1 2]))
ylabel('Concentration (g/L)')
yyaxis right
plot(t, C(:,3))
ylabel('Concentration (\mu g/L')
grid
legend('C_1','C_2','C_3', 'Location','W')
end
function dCdt=ParameterZhang(t,C,Miumax,Ks,Kxi,KXI,CXm,CPm,Miupx,YPX,KPS,Kpi,KPI,KP,Miusx,YXS,YPS)
z = [1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20];
j = 1;
for j = 1 : 20
if z(j) <= 4
I = 45;
elseif z(j) <= 7
I = 90;
elseif z(j) <= 11
I = 120;
elseif z(j) <= 15
I = 150;
else
I = 180;
end
mu = ((Miumax*C(2))/(Ks+C(2)+(C(2)^2/Kxi)))*(I/(KXI+I))*(1-C(1)/CXm)*(1-C(3)/CPm);
dCdt(1,:) = mu*C(1);
dCdt(2,:) = (-(1/YXS)*dCdt(1))+(-(1/YPS)*dCdt(3))+(-Miusx*C(1));
dCdt(3,:) = (YPX*dCdt(1)+Miupx*C(1))*(C(2)/(KPS+C(2)+C(2)^2/Kpi))*(C(3)/(KP+C(3)))*(I/(KPI+I));
end
end
Accepted Answer
More Answers (0)
Categories
Find more on Numerical Integration and Differential Equations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!