Compute auto-covariance matrix from noise
9 ビュー (過去 30 日間)
古いコメントを表示
Hi. I've been given an assignment to generate WGN (white gaussian noise) and compute its 5x5 covariance matrix.
We generate the wgn from x = randn(1,10000);
I understand that there is a cov() function, but we're not supposed to use that, plus when I try to use cov() I get a 2x2 matrix. The cov matrx is
[
E(x1 - E(x1)) * (x1 - E(x1)) E(x1 - E(x1) * (x2 - E(x2))
E(x2 - E(x2) * (x1 - E(x1)) E(x2 - E(x2) * (x2 - E(x2))
]
And so on diagonally. Would I need to generate 5 WGN signals (x1 - x5 for example) and itterate through each value to find the covariance matrix?
Any help is appreciated. Thanks :)
0 件のコメント
回答 (1 件)
Jon
2020 年 2 月 10 日
You can generate the 5 signals in just one call to randn, for example
x = randn(10000,5);
Which will make a matrix with 10000 rows and 5 columns (one column for each signal) .
You should then be able to do the math to compute the covariance using MATLAB vectorized approach without needing to use loops.
For example to get the mean value of each column you can use
xbar = mean(x)
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Spectral Estimation についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!