vendredi 28 avril 2017

Generating two standard normal variables with specific correlation (MATLAB)

I want to generate two standard normal variables (mean = 0, variance = 0) with a specific correlation (e.g. .2). To do this I am using the mvnrnd() function. Documentation here

I am having trouble understanding the documentation completely, but I believe this would do the trick: mvnrnd([0,0],[1,.2;.2,1]) with [0,0] representing the mean of the two variables and [1,.2;.2,1] representing the covariance matrix (which is the same as the correlation matrix since the variance for both variables is 1) that looks like this:

1 .2

.2 1

Is that correct?




Aucun commentaire:

Enregistrer un commentaire