Generates random data from the beta probability distribution. There are two forms. |
||
Syntax |
RND = BetaRnd(a, b, Rows, Cols, Seed, State) RND = BetaRnd(a, b, Seed, State) |
|
Arguments |
Name |
Description |
a |
First shape parameter. A scalar, vector, or matrix of positive values. |
|
b |
Second shape parameter. A scalar, vector, or matrix of positive values. |
|
Rows (optional) |
Number of output rows. A positive integer. Only valid when a and b are scalars. |
|
Cols (optional) |
Number of output columns. A positive integer. Only valid when a and b are scalars. |
|
Seed (optional) |
The seed to initialize the random number generator. An integer. See Comments below. |
|
State (optional) |
Set to "discard" if the state of the pseudo random number is not to be retained for future use. The default is "retain". |
|
Outputs |
Name |
Description |
RND |
Random numbers from the beta distribution. Its dimensions are determined by the input arguments. See Comments below. |
|
Example 1 |
Generate two random numbers from the beta distribution with (a, b) pairs of (2, 5) and (4,3), respectively, with a random seed of 2003. |
|
Syntax |
||
rnd = BetaRnd([2,4],[5,3],2003) |
||
Results |
||
rnd = 0.25963 0.53191 |
||
Example 2 |
Generate a 1x4 vector of random numbers from the beta distribution with a = 2 and b = 5, with a random seed of 2003. |
|
Syntax |
||
rnd = BetaRnd(2,5,1,4,2003) |
||
Results |
||
rnd = 0.25963 0.25424 0.038244 0.043708 |
||
Comments |
a and b must be the same size. If the optional size inputs are omitted, the size of the output is solely determined by the size of the two inputs, a and b. Each entry in the output uses the corresponding entries in the two inputs. If the optional size inputs are provided, both must be supplied. In that case, a and b must be scalars and the size of the output is determined by Rows and Cols. That is, the inputs a and b are used for each element of the output. The Seed can be any number. Using a seed allows a random sequence to be repeated. |
|
See Also: |