Home > src > geckomat > kcat_sensitivity_analysis > Bayesian > getrSample.m

getrSample

PURPOSE ^

getrSample

SYNOPSIS ^

function r = getrSample(mu,sigma,step,method)

DESCRIPTION ^

 getrSample
   Samples random kcats from a distribution.

 Input:
   mu              Mean of distribution (data is logged to get a normal distr)
   sigma           Std deviation of the distribution
   step            Number of kcats to sample
   method          shape of distribution: 'normal' or 'uniform'. 
                   (Optional, default is 'normal')
 Output:
   r               The sampled kcats

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function r = getrSample(mu,sigma,step,method)
0002 % getrSample
0003 %   Samples random kcats from a distribution.
0004 %
0005 % Input:
0006 %   mu              Mean of distribution (data is logged to get a normal distr)
0007 %   sigma           Std deviation of the distribution
0008 %   step            Number of kcats to sample
0009 %   method          shape of distribution: 'normal' or 'uniform'.
0010 %                   (Optional, default is 'normal')
0011 % Output:
0012 %   r               The sampled kcats
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     %sigmatmp = log10(sigma/3600);
0022     sigmatmp = sigma;
0023     pd = makedist('normal','mu',mutmp,'sigma',sigmatmp);
0024     %t = truncate(pd,-3,8);
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

Generated by m2html © 2005