Julia - Generate multivariate Gaussian samples with given mean and covariance matrix using mvNormal

Viewed 1537

I need to generate, say 2000 samples of 2D multivariate Gaussian distribution with mean [2;3] and covaraince C = [0.2 0; 0 0.3] in Julia. Is it possible to do it using MvNormal function from Distributions package?

Thanks in advance.

1 Answers

You can just straight up write down the code exactly as you describe

using Distributions
mean = [2.,3.]
C = [0.2 0; 0 0.3]
d = MvNormal(mean, C)
x = rand(d, 2000)

so, the answer to your question is yes.

Related