Skip to content
Snippets Groups Projects
Commit a855951e authored by Zhefu Li's avatar Zhefu Li
Browse files

Update model.html

parent 832ebee9
No related branches found
No related tags found
No related merge requests found
......@@ -7,9 +7,7 @@
<link rel="icon" type="image/png" href="https://static.igem.wiki/teams/5187/art/icon1.png" sizes="364x370">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.5.1/styles/default.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.5.1/highlight.min.js"></script>
<script>
hljs.highlightAll();
</script>
<script>hljs.highlightAll();</script>
<title>Tsinghua - IGEM 2024</title>
<script type="text/javascript" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
<style>
......@@ -325,87 +323,85 @@
<button id="Button1" onclick="toggleCodeSnippet()">Expand the code</button>
<div id="codeSnippet" class="code-snippet">
```metlab
% Define parameters
Q_inhale = 100; % mg
k_exhale = 10;
k_perm = 0.005;
k_adh = 0.001;
k_diffMC = 0.01;
k_diffLC = 0.05;
k_dist = 0.001;
k_excrete = 0.05;
k_move = 0.02;
% Define the time range
tspan = [0 300]; % From 0 to 5 minutes
initial_conditions = [0 0 0 0 0]; % The initial condition is 0
% solve ODE
[t, y] = ode45(@(t,y) odefun(t, y, Q_inhale, k_exhale, k_perm, k_adh, k_diffMC, k_diffLC, k_dist,
k_excrete, k_move), tspan, initial_conditions);
% calculate V_inhale
V_inhale = Q_inhale / 5 * (heaviside(t) - heaviside(t-5));
figure('Position', [100, 100, 1200, 1000]);
% V_inhale(t)
subplot(3,2,1)
plot(t, V_inhale)
title('V_{inhale}(t)')
xlabel('Time (s)')
ylabel('V_{inhale}')
% Q_A(t)
subplot(3,2,2)
plot(t, y(:,1))
title('Q_A(t)')
xlabel('Time (s)')
ylabel('Q_A')
% Q_L(t)
subplot(3,2,3)
plot(t, y(:,2))
title('Q_L(t)')
xlabel('Time (s)')
ylabel('Q_L')
% Q_M(t)
subplot(3,2,4)
plot(t, y(:,3))
title('Q_M(t)')
xlabel('Time (s)')
ylabel('Q_M')
% Q_C(t)
subplot(3,2,5)
plot(t, y(:,4))
title('Q_C(t)')
xlabel('Time (s)')
ylabel('Q_C')
% Q_I(t)
subplot(3,2,6)
plot(t, y(:,5))
title('Q_I(t)')
xlabel('Time (s)')
ylabel('Q_I')
sgtitle('Simulation Results')
% ODE
function dydt = odefun(t, y, Q_inhale, k_exhale, k_perm, k_adh, k_diffMC, k_diffLC, k_dist,
k_excrete, k_move)
V_inhale = Q_inhale / 5 * (heaviside(t) - heaviside(t-5));
dydt = zeros(5,1);
dydt(1) = V_inhale - (k_exhale + k_perm) * y(1); % dQ_A/dt
dydt(2) = k_perm * y(1) - k_diffLC * y(2); % dQ_L/dt
dydt(3) = 0.0005 * k_adh * V_inhale - k_diffMC * y(3); % dQ_M/dt
dydt(4) = k_diffMC * y(3) + k_diffLC * y(2) - k_dist * y(4) - k_excrete * y(4); % dQ_C/dt
dydt(5) = k_dist * y(4) - k_move * y(5); % dQ_I/dt
end
```
% Define parameters
Q_inhale = 100; % mg
k_exhale = 10;
k_perm = 0.005;
k_adh = 0.001;
k_diffMC = 0.01;
k_diffLC = 0.05;
k_dist = 0.001;
k_excrete = 0.05;
k_move = 0.02;
% Define the time range
tspan = [0 300]; % From 0 to 5 minutes
initial_conditions = [0 0 0 0 0]; % The initial condition is 0
% solve ODE
[t, y] = ode45(@(t,y) odefun(t, y, Q_inhale, k_exhale, k_perm, k_adh, k_diffMC, k_diffLC, k_dist,
k_excrete, k_move), tspan, initial_conditions);
% calculate V_inhale
V_inhale = Q_inhale / 5 * (heaviside(t) - heaviside(t-5));
figure('Position', [100, 100, 1200, 1000]);
% V_inhale(t)
subplot(3,2,1)
plot(t, V_inhale)
title('V_{inhale}(t)')
xlabel('Time (s)')
ylabel('V_{inhale}')
% Q_A(t)
subplot(3,2,2)
plot(t, y(:,1))
title('Q_A(t)')
xlabel('Time (s)')
ylabel('Q_A')
% Q_L(t)
subplot(3,2,3)
plot(t, y(:,2))
title('Q_L(t)')
xlabel('Time (s)')
ylabel('Q_L')
% Q_M(t)
subplot(3,2,4)
plot(t, y(:,3))
title('Q_M(t)')
xlabel('Time (s)')
ylabel('Q_M')
% Q_C(t)
subplot(3,2,5)
plot(t, y(:,4))
title('Q_C(t)')
xlabel('Time (s)')
ylabel('Q_C')
% Q_I(t)
subplot(3,2,6)
plot(t, y(:,5))
title('Q_I(t)')
xlabel('Time (s)')
ylabel('Q_I')
sgtitle('Simulation Results')
% ODE
function dydt = odefun(t, y, Q_inhale, k_exhale, k_perm, k_adh, k_diffMC, k_diffLC, k_dist,
k_excrete, k_move)
V_inhale = Q_inhale / 5 * (heaviside(t) - heaviside(t-5));
dydt = zeros(5,1);
dydt(1) = V_inhale - (k_exhale + k_perm) * y(1); % dQ_A/dt
dydt(2) = k_perm * y(1) - k_diffLC * y(2); % dQ_L/dt
dydt(3) = 0.0005 * k_adh * V_inhale - k_diffMC * y(3); % dQ_M/dt
dydt(4) = k_diffMC * y(3) + k_diffLC * y(2) - k_dist * y(4) - k_excrete * y(4); % dQ_C/dt
dydt(5) = k_dist * y(4) - k_move * y(5); % dQ_I/dt
end
</div>
<script>
function toggleCodeSnippet() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment