From a7687a88a9df9626917705c373d687a1ab4a8f42 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Luk=C3=A1=C5=A1=20Ji=C5=99i=C5=A1t=C4=9B?= Date: Tue, 14 May 2024 15:01:33 +0200 Subject: [PATCH] Implement process_experiment function This function accepts the pressure-time dependence along with other important characteristics of the aparature (volumes, temperature). It also optionally accepts the pressure of V1 which is then used to get a more precise value for the pressure after connecting V1 to V2. --- process_experiment.m | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 process_experiment.m diff --git a/process_experiment.m b/process_experiment.m new file mode 100644 index 0000000..74cfc5a --- /dev/null +++ b/process_experiment.m @@ -0,0 +1,13 @@ +function [p_eq n] = process_experiment(t, p, V1, V2, Vvz, p_up = 0, T = 298, graph = 1, threshold = 0.05) + R = 8.314; + [p_eq, p_ao] = get_important_pressure(t, p, graph, threshold); + if (p_up != 0) + p_ao = (p_up(find(detect_open(t, p, threshold) == 1) - 1) * V1 + p_eq(1:(end - 1)) .* (V2 - Vvz)) / (V1 + V2 - Vvz); + end + delta_n = (p_ao - p_eq(2:end)) .* (V1 + V2 - Vvz) / R / T; + n = cumsum(delta_n); + if (graph) + figure(); + plot(p_eq, [0 n], "-o"); + end +end -- 2.30.2