define beta distribution function

조회 수: 6 (최근 30일)
Saurabh Agarwal
Saurabh Agarwal 2020년 5월 3일
댓글: Ameer Hamza 2020년 5월 4일
how to define N=100000 random variables in beta distribution
Lower bound L (%) 1.0
Upper bound U (%) 3.5
Coefficient a (alpha) 0.23
Coefficient b (beta) 0.33
and also after defining it how to plot and check.

채택된 답변

Ameer Hamza
Ameer Hamza 2020년 5월 3일
If you have Statistics and Machine Learning Toolbox, then you can use betarnd(): https://www.mathworks.com/help/releases/R2020a/stats/betarnd.html
a = 0.23;
b = 0.33;
x = betarnd(a, b, 1, 100000);
histogram(x, 'Normalization', 'pdf')
  댓글 수: 8
Saurabh Agarwal
Saurabh Agarwal 2020년 5월 4일
as you can see that horizontal axis is limited to 0.4 to 1.2 and whole distibution is defined in it.
Ameer Hamza
Ameer Hamza 2020년 5월 4일
Try this.
a = 0.23;
b = 0.33;
l = 1;
u = 3.3;
x = rescale(betarnd(a, b, 1, 100000), l, u);
histogram(x, 'Normalization', 'pdf')

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

제품

Community Treasure Hunt

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

Start Hunting!

Translated by