define beta distribution function

9 次查看(过去 30 天)
how to define N=100000 random variables in beta distribution with (an=0, bn=1) mu(mean)=0.37 sigma(standard deviation)=0.07

采纳的回答

Ameer Hamza
Ameer Hamza 2020-4-30
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 个)

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by