Generate noise with arbitrary covariance I am doing a time series change detection experiment.  One of the experiments includes generating some artificial data for model evaluation. 

I came across a problem in generating noise data with some arbitrary covariance at every 100 time steps.

While randn from Matlab allows me to generate the value, I am never able to figure how to change the covariance of the data.  Is there any example that I can refer to?
If you want a Gaussian vector $X$ with $E(X)=0$ and $E(X\,X^T)=C$, then find a decomposition $C=AA^T$, for instance a Cholesky decomposition, compute a vector $U$ with standard normal uncorrelated random numbers as components and set $X=AU$.