From: Lukáš Jiřiště Date: Tue, 7 May 2024 13:51:28 +0000 (+0200) Subject: Add a function that generates pseudo experiment X-Git-Url: https://git.ljiriste.work/?a=commitdiff_plain;h=71a8ad28f9aceba75b1c251eb6a36eeecc0ede54;p=analyse_servo.git Add a function that generates pseudo experiment I add this function to generate data that is qualitatively similar to the data produced by the experiment. The real data may prove more difficult, but the structure of the processing should be the same. --- 71a8ad28f9aceba75b1c251eb6a36eeecc0ede54 diff --git a/pseudo_exp.m b/pseudo_exp.m new file mode 100644 index 0000000..a1af932 --- /dev/null +++ b/pseudo_exp.m @@ -0,0 +1,11 @@ +function [t, p, t_open] = pseudo_exp(p1, V1, V2, Vvz, n) + t_open = rand(1, n) * (50 - 15) + 15; + t_open = ceil(cumsum(t_open)); + t = (0:ceil(t_open(n)) + 20); + p = rand(size(t)) * p1 / 100; + for i = ceil(t_open) + p2 = (p(i + 1) * (V2 - Vvz) + p1 * V1) / (V1 + V2 - Vvz); + peq = 0.7 * p2; + p(i + 1:end) += (p2 - peq) * exp((-(i + 1:length(p)) + i) / 10) + peq; + end +end