Gamma mean and variance
[M,V] = gamstat(A,B)
[M,V] = gamstat(A,B) returns the mean of and
variance for the gamma distribution with shape parameters in
A and scale
B can be
vectors, matrices, or multidimensional arrays that have the same size, which is also the
V. A scalar input for
B is expanded to a constant array with the
same dimensions as the other input. The parameters in
B must be positive.
The mean of the gamma distribution with parameters A and B is AB. The variance is AB2.
[m,v] = gamstat(1:5,1:5) m = 1 4 9 16 25 v = 1 8 27 64 125 [m,v] = gamstat(1:5,1./(1:5)) m = 1 1 1 1 1 v = 1.0000 0.5000 0.3333 0.2500 0.2000
This function fully supports GPU arrays. For more information, see Run MATLAB Functions on a GPU (Parallel Computing Toolbox).