In matlab it is easy to generate a normally distributed random vector with a mean and a standard deviation. From the help randn:
Generate values from a normal distribution with mean 1 and standard deviation 2. r = 1 + 2.*randn(100,1);
Now I have a covariance matrix C and I want to generate N(0,C).
But how could I do this?
From the randn help: Generate values from a bivariate normal distribution with specified mean vector and covariance matrix. mu = [1 2]; Sigma = [1 .5; .5 2]; R = chol(Sigma); z = repmat(mu,100,1) + randn(100,2)*R;
But I don't know exactly what they are doing here.
mu
is the mean vector (in your case 0, so leave it off),Sigma
is the covariance matrix, and they're generating 100 pairs of random numbers. – Donnie