Open in the MATLAB editor: g05sg_example
function g05sg_example fprintf('g05sg example results\n\n'); % Initialize the base generator to a repeatable sequence seed = [int64(1762543)]; genid = int64(1); subid = int64(1); [state, ifail] = g05kf( ... genid, subid, seed); % Number of variates n = int64(5); % Parameters a = [1; 5; 2]; wgt = [0.5; 0.3; 0.2]; % Generate variates from an exponential mix distribution [state, x, ifail] = g05sg( ... n, a, wgt, state); disp('Variates'); disp(x);
g05sg example results Variates 0.4520 2.2398 1.4649 0.2253 11.2884