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.
--- /dev/null
+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