Section: Random Number Generation
randbeta is
y = randbeta(alpha, beta)
where alpha and beta are the two parameters of the
random deviate. There are three forms for calling randbeta.
The first uses two vectors alpha and beta of the same
size, in which case the output y is the same size as both
inputs, and each deviate uses the corresponding values of alpha
and beta from the arguments. In the other forms, either
alpha or beta are scalars.
for x between 0 and 1. The function B(a,b) is defined so
that the integral of f(x) is 1.
a=3,
b=7.
--> a = 3; b = 7; --> x = (0:100)/100; t = x.^(a-1).*(1-x).^(b-1); --> t = t/(sum(t)*.01); --> plot(x,t);
which is plotted as
If we generate a few random deviates with these values,
we see they are distributed around the peak of roughly
0.25.
--> randbeta(3*ones(1,5),7*ones(1,5)) ans = <float> - size: [1 5] Columns 1 to 5 0.27769583 0.06421967 0.33052161 0.52589989 0.40028515