0001 function r = getrSample(mu,sigma,step,method)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 if nargin < 4
0015 method = 'normal';
0016 end
0017 if mu == 0
0018 r = zeros(1,step);
0019 elseif strcmp(method,'normal')
0020 mutmp = log10(mu/3600);
0021
0022 sigmatmp = sigma;
0023 pd = makedist('normal','mu',mutmp,'sigma',sigmatmp);
0024
0025 r = random(pd,1,step);
0026 r = 10.^(r).*3600;
0027 elseif strcmp(method,'uniform')
0028 mutmp = log10(mu/3600);
0029 sigmatmp = sigma;
0030 pd = makedist('uniform','lower',mutmp-sigmatmp,'upper',mutmp + sigmatmp);
0031 t = truncate(pd,-2,8);
0032 r = random(t,1,step);
0033 r = 10.^(r).*3600;
0034 end
0035
0036 r(r<0) = 0;
0037
0038 end