function F = gamma_cdf( x, params )
% F = gamma_cdf( x, [ m, c ] )
% compute the CDF of the gamma probability distribution function
% in terms of it's mean (m) and coefficient of variation (c)

 m   = params(1);			% mean of X
 c   = params(2);			% standard deviation of X

 if (c < 0.5)
   printf('c = %f, lower limit of coefficient of variation is 0.5 \n', c );
 end

 k     = 1/c^2;          % shape parameter 
 theta = c^2*m;          % scale parameter

 xp = x;
 xp(find(x<0)) = 1e-5;

 F = gammainc(xp/theta,k);

 F(find(x<=0)) = 0;

% gamma_cdf ---------------------------------------------------- 3 March 2015
