define beta distribution function
5 views (last 30 days)
Show older comments
Saurabh Agarwal
on 30 Apr 2020
Answered: Ameer Hamza
on 30 Apr 2020
how to define N=100000 random variables in beta distribution with (an=0, bn=1) mu(mean)=0.37 sigma(standard deviation)=0.07
0 Comments
Accepted Answer
Ameer Hamza
on 30 Apr 2020
You cannot independently choose the a, b parameters, and mu, sigma. You can only choose one pair at a time. Also, parameter an=0 and bn=1 only generate constant zero, so I suppose you wrote that by mistake. The following shows how to generate random beta numbers with mean=0.37 and std=0.07. It uses formula from this line: https://en.wikipedia.org/wiki/Beta_distribution#Mean_and_variance
mu = 0.37;
std = 0.07;
var = std.^2;
v = mu*(1-mu)/var-1;
a = mu*v;
b = (1-mu)*v;
N = 100000;
r = betarnd(a, b, N, 1);
0 Comments
More Answers (0)
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!