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

Update model.html

parent adb4818d
No related branches found
No related tags found
No related merge requests found
......@@ -304,7 +304,7 @@
muskone in the intestine can be obtained in combination with experimental determination. Because
there is no animal experimental support, the data are manually drafted, and the calculation method
is more meaningful than the calculation results.</p>
<button onclick="toggleCodeSnippet()">Expand the code</button>
<button id="Button1" onclick="toggleCodeSnippet()">Expand the code</button>
<div id="codeSnippet" class="code-snippet">
```metlab
......@@ -318,8 +318,85 @@
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
```
</div>
<script>
function toggleCodeSnippet() {
var codeSnippet = document.getElementById("codeSnippet");
var button = document.getElementById("Button1"); // 注意变量名通常使用小写开头
if (codeSnippet.style.display === "none") {
codeSnippet.style.display = "block";
button.textContent = "Collapse the code"; // 使用之前选中的按钮元素
} else {
codeSnippet.style.display = "none";
button.textContent = "Expand the code"; // 使用之前选中的按钮元素
}
}
</script>
</div>
</div>
......
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