Implement process_experiment function
authorLukáš Jiřiště <jiriste@icpf.cas.cz>
Tue, 14 May 2024 13:01:33 +0000 (15:01 +0200)
committerLukáš Jiřiště <jiriste@icpf.cas.cz>
Tue, 14 May 2024 13:01:33 +0000 (15:01 +0200)
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 [new file with mode: 0644]

diff --git a/process_experiment.m b/process_experiment.m
new file mode 100644 (file)
index 0000000..74cfc5a
--- /dev/null
@@ -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