[m,v] = unifstat(a,b)
returns the element-wise mean and variance of the continuous uniform distribution defined by
the lower endpoint (minimum) a and upper endpoint (maximum)
b. The endpoints a and b
can be scalars, vectors, or multidimensional arrays.
Compute the mean and variance of a continuous uniform standard distribution.
a = 0;
b = 1;
[m,v] = unifstat(a,b)
m =
0.5000
v =
0.0833
Create two vectors a and b, where a is the lower endpoint and b is the upper endpoint of a continuous uniform distribution. Return the mean m and variance v of the continuous uniform distribution defined by a and b.
a = 1:6;
b = 2*a;
[m,v] = unifstat(a,b)
m = 1×6
1.5000 3.0000 4.5000 6.0000 7.5000 9.0000
v = 1×6
0.0833 0.3333 0.7500 1.3333 2.0833 3.0000
If the lower endpoint a is greater than or equal to the upper endpoint b, unifstat returns NaN.
Lower endpoint of the continuous uniform distribution, specified as a numeric
scalar, vector, or array.
If a is a numeric vector or an
array, then it must have the same size as b. If
a is a numeric scalar, the function expands a
to a constant matrix that has the same dimensions as b.
Example: [0 -1 7 9]
Data Types: single | double
Upper endpoint of the continuous uniform distribution, specified as a numeric
scalar, vector, or array.
If b is a numeric vector or an
array, then it must have the same size as a. If
b is a numeric scalar, the function expands b
to a constant matrix that has the same dimensions as a.
Element-wise mean of a continuous uniform distribution, returned as a numeric
scalar, vector, or array.
Each element in m is the mean of a distribution specified by
the corresponding elements in a and b. If
a and b are not the same size,
m is the size of a and
b after any necessary scalar expansion. If
a(i) is greater than or equal to b(i), then
m(i) is NaN, where i is
the index of an element. The mean of the continuous uniform distribution with endpoints
a and b is (a + b)/2.
Element-wise variance of a continuous uniform distribution, returned as a numeric
scalar, numeric vector, or numeric array.
Each element in v is the variance of a distribution specified
by the corresponding elements in a and b. If
a and b are not the same size,
v is the size of a and
b after any necessary scalar expansion. If
a(i) is greater than or equal to b(i), then
v(i) is NaN, where i is
the index of an element. The variance of the continuous uniform distribution with
endpoints a and b is (a –
b)2/12.
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window.
Web browsers do not support MATLAB commands.
Seleziona un sito web
Seleziona un sito web per visualizzare contenuto tradotto dove disponibile e vedere eventi e offerte locali. In base alla tua area geografica, ti consigliamo di selezionare: .
Puoi anche selezionare un sito web dal seguente elenco:
Come ottenere le migliori prestazioni del sito
Per ottenere le migliori prestazioni del sito, seleziona il sito cinese (in cinese o in inglese). I siti MathWorks per gli altri paesi non sono ottimizzati per essere visitati dalla tua area geografica.