betarnd - Beta random numbers

Syntax

R = betarnd(A,B)
R = betarnd(A,B,v)
R = betarnd(A,B,m,n)
R = betarnd(A,B,m,n,o,...)

Description

R = betarnd(A,B) generates random numbers from the beta distribution with parameters specified by A and B. A and B can be vectors, matrices, or multidimensional arrays that have the same size, which is also the size of R. A scalar input for A or B is expanded to a constant array with the same dimensions as the other input.

R = betarnd(A,B,v) generates an array R of size v containing random numbers from the beta distribution with parameters A and B, where v is a row vector. If v is a 1-by-2 vector, R is a matrix with v(1) rows and v(2) columns. If v is 1-by-n, R is an n-dimensional array.

R = betarnd(A,B,m,n) generates an m-by-n matrix containing random numbers from the beta distribution with parameters A and B.

R = betarnd(A,B,m,n,o,...) generates an m-by-n-by-o-by-... multidimensional array containing random numbers from the beta distribution with parameters A and B.

Example

a = [1 1;2 2];
b = [1 2;1 2];

r = betarnd(a,b)
r =
  0.6987  0.6139
  0.9102  0.8067

r = betarnd(10,10,[1 5])
r =
  0.5974  0.4777  0.5538  0.5465  0.6327

r = betarnd(4,2,2,3)
r =
  0.3943  0.6101  0.5768
  0.5990  0.2760  0.5474

See Also

random, betapdf, betacdf, betainv, betastat, betafit, betalike

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS