Hello all,
Is there any built-in function in MATLAB to generate a Gaussian noise with a specific covariance matrix R (colored noise), not necessarily the identity matrix (white noise)?
Thanks

 採用された回答

Matt J
Matt J 2014 年 5 月 23 日
編集済み: Matt J 2014 年 5 月 23 日

0 投票

There's MVRND, if you have the Stats Toolbox.
Otherwise, you can just do
sqrtm(R)*randn(size(R,2),1);

5 件のコメント

S. David
S. David 2014 年 5 月 23 日
編集済み: S. David 2014 年 5 月 23 日
Both are equivalent right? Because using the first method I have an error saying R must be symmetric semi-positive. It seems to be symmetric but I am not sure about semi-positive.
What is the difference between sqrt® and sqrtm®? Don't they both give the same results?
Matt J
Matt J 2014 年 5 月 23 日
It seems to be symmetric but I am not sure about semi-positive.
All covariance matrices are positive semi-definite. R therefore has to be psd in order to be a legitimate candidate.
What is the difference between sqrt® and sqrtm®?
sqrt is the elementwise square root and sqrtm is the matrix square root.
S. David
S. David 2014 年 5 月 23 日
I am computing R numerically. May be there is some precision errors to be perfectly symmetric.
Anyway, I am using the second method.
Thanks for your answer.
Matt J
Matt J 2014 年 5 月 24 日
編集済み: Matt J 2014 年 5 月 24 日
If R is close to singular, it can be mis-perceived as having some negative eigenvalues (and hence as not being psd) due to numerical imprecision.
However, if your R is close to singular, it really means you're taking the covariance of have some redundant variables - some of them are approximately linear combinations of the others - and should get rid of them.
S. David
S. David 2014 年 5 月 24 日
編集済み: S. David 2014 年 5 月 24 日
I have two matrices, and I found the eigenvalue of both of them: one of them has all positive eigenvalues, but the other has some negative eigenvalues. I guess the second one is close to singular as you said. But even when I try the first one in mvrand(Mu,Sigma), I still get the same error.
For the matrix with negative eigenvalues, how to eliminate the redundant variables?

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeEigenvalues & Eigenvectors についてさらに検索

質問済み:

2014 年 5 月 23 日

編集済み:

2014 年 5 月 24 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by