From 04509012f623be5cc87e021deb01b02aeaef25b2 Mon Sep 17 00:00:00 2001 From: Zhefu Li <zf-li23@mails.tsinghua.edu.cn> Date: Tue, 24 Sep 2024 02:41:35 +0000 Subject: [PATCH] Update model.html --- wiki/pages/model.html | 79 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 78 insertions(+), 1 deletion(-) diff --git a/wiki/pages/model.html b/wiki/pages/model.html index cd9cb92d..b03d8457 100644 --- a/wiki/pages/model.html +++ b/wiki/pages/model.html @@ -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> -- GitLab