This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.


Discrete uniform mean and variance


[M,V] = unidstat(N)


[M,V] = unidstat(N) returns the mean and variance of the discrete uniform distribution with minimum value 1 and maximum value N.

The mean of the discrete uniform distribution with parameter N is (N + 1)/2. The variance is (N2 – 1)/12.


[m,v] = unidstat(1:6)
m =
  1.0000  1.5000  2.0000  2.5000  3.0000  3.5000
v =
  0  0.2500  0.6667  1.2500  2.0000  2.9167

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Introduced before R2006a

Was this topic helpful?