MATLAB Answers

How does MATLAB compute the covariance of a complex array?

13 views (last 30 days)
njj1
njj1 on 10 Aug 2017
Commented: EMAD M R SALEH on 7 Dec 2019
I'm working with a complex array and looking at the covariance matrix and the relation matrix. (The explanation of these matrices can be found here: https://en.wikipedia.org/wiki/Complex_normal_distribution.) When I am compute the covariance matrix using cov(), the matrix looks more like the relation matrix. Consider a toy example:
>> u = [1 + 1i, 2 + 1.5*1i;1 + 2*1i,3+1i;3+1.5*1i,1+1.5*1i]
u =
1.0000 + 1.0000i 2.0000 + 1.5000i
1.0000 + 2.0000i 3.0000 + 1.0000i
3.0000 + 1.5000i 1.0000 + 1.5000i
>> cov(u)
ans =
1.5833 + 0.0000i -1.1250 - 0.0833i
-1.1250 + 0.0833i 1.0833 + 0.0000i
>> 0.5*(u-mean(u))' * (u-mean(u))
ans =
1.5833 + 0.0000i -1.1250 - 0.0833i
-1.1250 + 0.0833i 1.0833 + 0.0000i
>> 0.5*conj((u-mean(u))') * (u-mean(u))
ans =
1.0833 + 0.0000i -0.8750 + 0.4167i
-0.8750 + 0.4167i 0.9167 - 0.5000i
The second method of computing the covariance matrix is basically what MATLAB is doing. However, according to the above Wiki article, this is the relation matrix, not the covariance matrix. The third method of computing the covariance matrix is how MATLAB claims to compute the convariance matrix as can be seen in its Help documentation on cov(). However, the results are clearly different.
So my question is: How does MATLAB actually comput the covariance matrix? I don't think it actually uses the conjugate transpose, but rather only uses the transpose.

Answers (1)

njj1
njj1 on 10 Aug 2017
So I answered my own question almost a minute after asking it. Turns out the transpose command, ', is actually the conjugate transpose. An alternate way of performing this operation is the command ctranspose(). So the reason the answers were different was because I was conjugating the conjugate transpose.
Anyhow, I wanted to leave this up in case anyone else had a similar question.

Community Treasure Hunt

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

Start Hunting!