spm_gamrnd.m 969 B

12345678910111213141516171819202122232425
  1. function r = spm_gamrnd(a,b,varargin)
  2. % Random arrays from gamma distribution - a compiled routine
  3. % FORMAT r = spm_gamrnd(a,b,m,n,...)
  4. %
  5. % a - shape parameter
  6. % b - scale parameter
  7. % m,n,... - dimensions of the output array [optional]
  8. %
  9. % r - array of random numbers chosen from the gamma distribution
  10. %__________________________________________________________________________
  11. %
  12. % Reference
  13. %
  14. % George Marsaglia and Wai Wan Tsang, "A Simple Method for Generating Gamma
  15. % Variables": ACM Transactions on Mathematical Software, Vol. 26, No. 3,
  16. % September 2000, Pages 363-372
  17. % http://portal.acm.org/citation.cfm?id=358414
  18. %__________________________________________________________________________
  19. % Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging
  20. % Guillaume Flandin
  21. % $Id: spm_gamrnd.m 3251 2009-07-06 17:29:44Z guillaume $
  22. %-This is merely the help file for the compiled routine
  23. error('spm_gamrnd.c not compiled - see Makefile');