필터 지우기
필터 지우기

Determining the steady-state concentrations using your numerical solutions.

조회 수: 3 (최근 30일)
Mckale Grant
Mckale Grant 2022년 1월 26일
댓글: Rena Berman 2022년 3월 21일
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