How do I generate K samples of size n from a multivariate normal?
Show older comments
I'm given a multivariate normal distribution with
mu = [3,4,0.5]'
and covariance matrix [1,0.2,0.7;0.2,1,0.5;0.7,0.5,1].
I would like to generate 5000 samples of size 40 and store them.
I think I understand how to generate a sample of size forty,
mux = [3;4;0.5];
sigma = [1 0.2 0.7;0.2 1 0.5;0.7 0.5 1];
R = mvnrnd(mux,sigma,40);
But I don't know how to repeat the process 5000 times or store it. I suspect I should use a for loop but am unsure. Thanks for any help you can provide.
Accepted Answer
More Answers (0)
Categories
Find more on Creating and Concatenating Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!