From 05c061ae48413e865728f6fa669b184a3331d662 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Luk=C3=A1=C5=A1=20Ji=C5=99i=C5=A1t=C4=9B?= Date: Mon, 13 May 2024 09:21:49 +0200 Subject: [PATCH] Implement better generation of pseudo exp. data --- pseudo_exp.m | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pseudo_exp.m b/pseudo_exp.m index a1af932..6435762 100644 --- a/pseudo_exp.m +++ b/pseudo_exp.m @@ -2,10 +2,12 @@ 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; + p = zeros(size(t)); + peq = 0; 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; + peq += 0.7 * (p2 - peq); + p(i + 1:end) = (p2 - peq) * exp((-(i + 1:length(p)) + i + 1) / 10) + peq; end + p += rand(size(t)) * p1 / 100; end -- 2.30.2