How to eliminate NaN in pearsrnd function in Matlab

조회 수: 2 (최근 30일)
Thamasha Samarasinghe
Thamasha Samarasinghe 2021년 10월 8일
댓글: Thamasha Samarasinghe 2021년 10월 11일
Hi,
I have a data set which has
mu=3.82
sigma=1.023
skew=-1.021
kurt=1.284.
When I put them in r=pearsrnd(mu,sigma,skew,kurt,39,1) function, I am getting NaN value for 'r'. Could anyone can please help me to eliminate NaN in here?
  댓글 수: 1
Thamasha Samarasinghe
Thamasha Samarasinghe 2021년 10월 8일
Since the above combination gives me the NaN value I tried to solve that as follows.
mu=3.82;
sigma=1.023;
x=normrnd(3.82,1.023,39,1);
skew=skewness(x);
kurt=kurtosis(x);
r=pearsrnd(mu,sigma,skew,kurt,39,1);
Could someone please tell me that method is correct or not?

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

채택된 답변

Shivam Singh
Shivam Singh 2021년 10월 11일
Some combinations of moments are not valid; in particular, the kurtosis must be greater than the square of the skewness plus 1. For more information, please refer to the "pearsrnd" function .
  댓글 수: 1
Thamasha Samarasinghe
Thamasha Samarasinghe 2021년 10월 11일
Thank you. Then do you know any other function that i can use for this combination instead of pearsrnd function ?

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

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by