From b2d19e206605ed9131b8eb9865fcad1da5b04684 Mon Sep 17 00:00:00 2001 From: Ju Eun Kang <133086206+jueun429@users.noreply.github.com> Date: Mon, 14 Jul 2025 12:44:00 +0900 Subject: [PATCH] Make follicle start times deterministic --- GynCycle_Original code/poissonproc.m | 36 ++++++++++++++++++---------- README.md | 9 ++++++- 2 files changed, 31 insertions(+), 14 deletions(-) diff --git a/GynCycle_Original code/poissonproc.m b/GynCycle_Original code/poissonproc.m index 91003cf..e5c955a 100644 --- a/GynCycle_Original code/poissonproc.m +++ b/GynCycle_Original code/poissonproc.m @@ -1,13 +1,23 @@ -function S =poissonproc(lambda,tspan) - -tb=tspan(1); %start time -te=tspan(2); %end time - -%alternative method: -N=poissrnd(lambda*(te-tb)); -U=rand([N,1]); -Usort=sort(U); -S=tb+(te-tb)*Usort; -%length(S) - -end +function S =poissonproc(lambda,tspan) +%POISSONPROC Deterministic replacement for follicle start times. +% S = POISSONPROC(LAMBDA,TSPAN) returns a vector of equally spaced +% start times within the interval defined by TSPAN. The number of +% generated times corresponds to the expected value LAMBDA*(TE-TB). + +tb = tspan(1); % start time +te = tspan(2); % end time + +% determine the number of events deterministically +N = max(round(lambda * (te - tb)), 0); + +if N <= 0 + S = []; + return +end + +% create uniform time points inside the interval (tb, te) +step = (te - tb) / (N + 1); +S = tb + step * (1:N); % row vector +S = S(:); % ensure column vector + +end diff --git a/README.md b/README.md index 58f1d91..f16a45b 100644 --- a/README.md +++ b/README.md @@ -1 +1,8 @@ -# MATLAB \ No newline at end of file +# MATLAB + +This repository contains a MATLAB implementation of the GynCycle menstrual +cycle model. The original code relied on Poisson-distributed start times for +new follicles. In this version `poissonproc.m` was changed to remove the +random Poisson process and instead generate deterministic, evenly spaced +times. This allows simulations to be reproducible without setting a random +seed.