Error when taking mean of generated random variables with gamma distribution.

조회 수: 1 (최근 30일)
Annaliese Keimel
Annaliese Keimel 2019년 10월 8일
답변: Martin C. 2019년 10월 8일
When I try and take the mean of my matrix of random variables I am getting the following error:
"Index in position 1 is invalid. Array indices must be positive integers or logical values.
Error in hw2envstats (line 42)
mean(sample1a,2)"
any ideas on what I may be doing incorrectly would be appreciated.
mean = 1;
stdev = sqrt(1);
skew1 = 0.25;
alpha1= (2/skew1)^2;
beta1 = (alpha1/1)^0.5;
zeta1 = 1 - (alpha1/beta1);
sample1a=gamrnd(alpha1,beta1,10000,10);
mean(sample1a,2)

답변 (1개)

Martin C.
Martin C. 2019년 10월 8일
you defined mean = 1. Then you try to use it as a function :)

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by