This repository has been archived on 2021-05-17. You can view files and clone it, but cannot push or open issues or pull requests.
scientificComputing/simulations/code/exprandom.m

9 lines
495 B
Matlab

n = 200; % number of time intervals
rate = 50.0; % event rate
t = exprnd(1.0/rate, n, 1); % exponentially distributed intervals
m = mean(t); % mean time interval
s = std(t); % corresponding standard deviation
fprintf('Generated n=%d random time intervals with rate=%.0fHz:\n', n, rate);
fprintf(' Expected mean interval=%.3fs, std=%.3fs\n', 1.0/rate, 1.0/rate);
fprintf(' Measured mean interval=%.3fs, std=%.3fs\n', m, s);