Determining the steady-state concentrations using your numerical solutions.

3 次查看(过去 30 天)
What are the dynamics? How do you determine the steady-state concentrations using numerical solutions?
Plot should look like the following
File 1
function dYdt = lab1_model(t,Y) % TODO - Write the function declaration.
% Name of the function is lab1_model
% TODO - Extract a, b, c, and d from input vector Y
a = Y(1);
b = Y(2);
c = Y(3);
d = Y(4);
% TODO - Define the constants k1 through k5
k1 = 3; % mM/s
k2 = 2; % 1/s
k3 = 2.5; % 1/mM*s
k4 = 3; % 1/s
k5 = 4; % 1/s
% TODO - Define dadt, dbdt, dcdt, dddt from the ODEs
dadt = k1 - k2 * a - k3 * a * b;
dbdt = k2 * a - k3 * a * b;
dcdt = k3 * a * b - k4 * c;
dddt = k3 * a * b - k5 * d;
% Create output column vector dYdt
dYdt = [dadt; dbdt; dcdt; dddt];
end
File 2
clear all
% TODO define the timespan to simulation
tRange = [0 4];
% TODO define the initial conditions
Y0 = [0; 0; 0; 0;];
% call the solver of choice (ode45 is fine)
[tSol,YSol] = ode15s(@(tSol,YSol)lab1_model(tSol,YSol),tRange,Y0);
% plot solutions to look like figure in lab
A = plot(tSol,YSol(:,1),'b','LineWidth',2);
hold on
B = plot(tSol,YSol(:,2),'m','LineWidth',2);
C = plot(tSol,YSol(:,3),'g','LineWidth',2);
D = plot(tSol,YSol(:,4),'r','LineWidth',2);
% make axis labels and change linestyles as desired
xlabel('Time (sec)')
ylabel('Concentration (mM)')
A.LineStyle = '-';
B.LineStyle = '--';
C.LineStyle = ':';
D.LineStyle = '-.';
% make a legend
legend({'A', 'B', 'C', 'D'}, 'Location','southeast')

回答(1 个)

Torsten
Torsten 2022-1-26
Set dadt,dbdt,dcdt and dddt to 0 and solve the algebraic system in a,b,c,d using fsolve, e.g.

类别

Help CenterFile Exchange 中查找有关 Programming 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by