Generate 2-dimensional normal-distribution

4 vues (au cours des 30 derniers jours)
Kristoffer Linder
Kristoffer Linder le 24 Oct 2018
Modifié(e) : Matt J le 24 Oct 2018
I want to generate 36 observations from a 2-dimensional normal distribution using the covariance matrix
C = [1 0.8;0.8 1];
Anyone know how to do this?

Réponse acceptée

Matt J
Matt J le 24 Oct 2018
Modifié(e) : Matt J le 24 Oct 2018
observations=randn(36,2)*sqrtm(C);
or,
observations=mvnrnd(zeros(36,2),C);
  1 commentaire
Kristoffer Linder
Kristoffer Linder le 24 Oct 2018
First solution follow the theory from the prevous question. Thanks!!!

Connectez-vous pour commenter.

Plus de réponses (0)

Produits


Version

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by