% The function rand_int_breath.m determines the time in which the next % respiratory cycle will be initiated during random-interval breathing. % This time, which is determined according to an independent probability % experiment governed by a modified exponential pdf, may range from one % to 15 seconds with a mean of five seconds (Berger et. al., 1989). % % Function arguments: none % % Function outputs: % t - time of initiation of next respiratory cycle % function t = rand_int_breath % Assigning variables. lambda = 0.2083; tmin = 1; tmax = 15; % Computing the time of the initiation of the next respiratory cycle. k = 1/(1 - exp(-lambda*(tmax-tmin))); t = tmin - (1/lambda)*log(1-(rand(1)/k));