Simulation of differential equations with multiple variables. Biotechnology
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Adam Anderson
am 8 Mai 2021
Kommentiert: Adam Anderson
am 8 Mai 2021
I want to simulate those differential equations and compare them with the values of X, P, S
my error: Array indices must be positive integers or logical values.
Error in @(t,a)[(umax(1-(a(3)/pmax)^n))*a(1);-((umax(1-(a(3)/pmax)^n))*a(1))/(yxs);ypx*((umax(1-(a(3)/pmax)^n))*a(1))]
function pos = paramfun1(x,tspan)
umax = x(1);
ypx = x(2);
yxs = x(3);
pmax = x(4);
xt0 = x(0.05,47,0);
f = @(t,a) [(umax(1-(a(3)/pmax)^n))*a(1);-((umax(1-(a(3)/pmax)^n))*a(1))/(yxs);ypx*((umax(1-(a(3)/pmax)^n))*a(1))];
[~,pos] = ode45(f,tspan,xt0);
B = [0.05,0.07,0.15,0.25,0.32,0.42,0.6,0.93,1.3,1.57,1.75,1.9]';
S = [47,76,45,42,40,35,28,21,9,2,0]';
P = [0,1,2,4,6,11,17,23,34,41,42,42]';
t = [0,2,4,6,8,10,12,14,16,18,20,22]'
umax = 0.33;
ypx = 0.90;
yxs = 0.0343;
pmax = 122.22;
n = 1.88;
%a(1) = x
%a(2) = s
%a(3) = p
f = @(t,a) [(umax(1-(a(3)/pmax)^n))*a(1);-((umax(1-(a(3)/pmax)^n))*a(1))/(yxs);ypx*((umax(1-(a(3)/pmax)^n))*a(1))];
xt0 = [0.5,47,0];
[tspan,a] = ode45(f,[0 47],xt0);
plot(tspan,a(:,1),tspan,a(:,2),tspan,a(:,3),t,[B,S,P],'o-')
title('Modelado Matemático: Levenspiel')
xlabel('Tiempo en hrs')
ylabel('Biomasa (X), Sustrato (S),Producto (P)')
hold off
0 Kommentare
Akzeptierte Antwort
Alan Stevens
am 8 Mai 2021
You set umax to be 0.33, but then treat it as a function in the definition of f. If umax should simply be multiplied by the other terms in f, then the following works (note that you only have 11 terms for S, whereas there are 12 terms for t, B and P).
B = [0.05,0.07,0.15,0.25,0.32,0.42,0.6,0.93,1.3,1.57,1.75,1.9]';
S = [47,76,45,42,40,35,28,21,9,2,0]'; % only 11 values!
P = [0,1,2,4,6,11,17,23,34,41,42,42]';
t = [0,2,4,6,8,10,12,14,16,18,20,22]';
umax = 0.33;
ypx = 0.90;
yxs = 0.0343;
pmax = 122.22;
n = 1.88;
%a(1) = x
%a(2) = s
%a(3) = p
f = @(t,a) [(umax*(1-(a(3)/pmax)^n))*a(1);-((umax*(1-(a(3)/pmax)^n))*a(1))/(yxs);ypx*((umax*(1-(a(3)/pmax)^n))*a(1))];
xt0 = [0.5,47,0];
[tspan,a] = ode45(f,[0 47],xt0);
plot(tspan,a(:,1),tspan,a(:,2),tspan,a(:,3))
hold on
plot(t,[B,P],'o-')
title('Modelado Matemático: Levenspiel')
xlabel('Tiempo en hrs')
ylabel('Biomasa (X),Producto (P)')
hold off
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Cardiology finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!