Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 23 additions & 13 deletions GynCycle_Original code/poissonproc.m
Original file line number Diff line number Diff line change
@@ -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
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
# MATLAB
# 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.