Compute auto-covariance matrix from noise
8 views (last 30 days)
Show older comments
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 Comments
Answers (1)
Jon
on 10 Feb 2020
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 Comments
See Also
Categories
Find more on Spectral Estimation in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!