From: Lukáš Jiřiště Date: Mon, 20 May 2024 14:10:25 +0000 (+0200) Subject: Minor changes to process_experiment X-Git-Url: https://git.ljiriste.work/?a=commitdiff_plain;h=5048ee635f6ac9825a1a71db8a4bea970776a231;p=analyse_servo.git Minor changes to process_experiment This function was quite high level so it only needed minor changes. It now calculates the "start" pressure - the pressure after opening the valve (which marks start of the sorption experiment cycle). --- diff --git a/process_experiment.m b/process_experiment.m index 74cfc5a..ac94b5e 100644 --- a/process_experiment.m +++ b/process_experiment.m @@ -1,13 +1,11 @@ -function [p_eq n] = process_experiment(t, p, V1, V2, Vvz, p_up = 0, T = 298, graph = 1, threshold = 0.05) +function [p_eq n] = process_experiment(t, p, V1, V2, Vvz, T = 298, graph = 1, threshold = 0.01) 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); + [p_eq, p_fill] = get_important_pressure(t, p, graph, threshold); + p_start = (p_eq(1:(end - 1)) * (V2 - Vvz) + p_fill * V1) / (V1 + V2 - Vvz); + delta_n = (p_start - p_eq(2:end)) .* (V1 + V2 - Vvz) / R / T; + n = [0 cumsum(delta_n)]; if (graph) figure(); - plot(p_eq, [0 n], "-o"); + plot(p_eq, n, "-o"); end end