How to create two independent Normal distribution ?

조회 수: 17 (최근 30일)
Masoud Dorvash
Masoud Dorvash 2021년 1월 2일
댓글: Masoud Dorvash 2021년 1월 2일
I want to create two (or more) independent distributions, then I want to find the Covariance of them.
My problem is how to define two independent distributions.
X = makedist('Normal');
Y = makedist('Normal');
Z = X + Y;
Here, I can't add these two distributions, even I don't know if they are independent or not.
  댓글 수: 2
Ive J
Ive J 2021년 1월 2일
편집: Ive J 2021년 1월 2일
You are creating PDF, see randn.
Masoud Dorvash
Masoud Dorvash 2021년 1월 2일
even with randn I can't be sure that the distributions are independent.

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

채택된 답변

Ive J
Ive J 2021년 1월 2일
편집: Ive J 2021년 1월 2일
You basically can generate multiple independent normal random variables form a multivariate normal dist. You just need to define var-covar matrix properly. So, to generate two iid vectors, you can generate them from a bivariate normal dist:
mu = [0 0];
Sigma = [1 0; 0 1]; % set off diagonals to zero
X = mvnrnd(mu, Sigma, 1e5);
% visual examination
histogram2(X(:,1), X(:,2))
% are they really independent?
histogram(sum(X, 2))

추가 답변 (0개)

카테고리

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

제품


릴리스

R2014a

Community Treasure Hunt

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

Start Hunting!

Translated by