Continuous uniform mean and variance
[M,V] = unifstat(A,B)
[M,V] = unifstat(A,B) returns
the mean of and variance for the continuous uniform distribution using
the corresponding lower endpoint (minimum),
upper endpoint (maximum),
B. Vector or matrix inputs
B must have the same
size, which is also the size of
A scalar input for
expanded to a constant matrix with the same dimensions as the other
The mean of the continuous uniform distribution with parameters a and b is (a + b)/2, and the variance is (a – b)2/12.
a = 1:6; b = 2.*a; [m,v] = unifstat(a,b) m = 1.5000 3.0000 4.5000 6.0000 7.5000 9.0000 v = 0.0833 0.3333 0.7500 1.3333 2.0833 3.0000
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Accelerate code by running on a graphics processing unit (GPU) using Parallel Computing Toolbox™.
This function fully supports GPU arrays. For more information, see Run MATLAB Functions on a GPU (Parallel Computing Toolbox).
Introduced before R2006a