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
470 B
Matlab

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