Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Complex Number Covariance Matrix
Date: Wed, 26 Mar 2008 01:40:05 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 56
Message-ID: <fsc9hk$j3p$1@fred.mathworks.com>
References: <fs983d$ofr$1@fred.mathworks.com> <fs9kjc$6e5$1@fred.mathworks.com> <fsamnv$ha4$1@fred.mathworks.com> <fsaqhp$p6m$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1206495605 19577 172.30.248.35 (26 Mar 2008 01:40:05 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 26 Mar 2008 01:40:05 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: news.mathworks.com comp.soft-sys.matlab:459166



"David Doria" <daviddoria@gmail.com> wrote in message <fsaqhp$p6m
$1@fred.mathworks.com>...
> So I tried this:
> 
> a = 5*rand(10, 1) + i*5*rand(10, 1);
> b = 5*rand(10, 1) + i*5*rand(10, 1);
> 
> u_a = mean(a);
> u_b = mean(b);
> 
> a=a-ua;
> b=b-ub;
> 
> c=corrcoef(a,b)
> 
> but the off diagonals are complex numbers - I want a 
> positive value between 0 and 1 - is the magnitude a good 
> enough value? or is there a better way?
> 
> Thanks,
> 
> David
---------
  Yes, if you recall, I stated that the two off-diagonal elements of the 
covariance matrix are complex conjugates of one another, and indeed they 
will in general be complex-valued for complex-valued arguments, x and y.  It 
is only the variances along the diagonal that are assured of being real-valued.  
In other words, the covariance matrix is always Hermitian.

  In the case of 'corrcoef', which also gives a Hermitian matrix, you are 
guaranteed that the absolute value of the corresponding correlation 
coefficients will lie between 0 and 1, so using that is a possibility for what you 
are doing.

  However, you will note that in taking the absolute value, you will have 
thereby eliminated negative correlation values which indicate opposite-sense 
relationships.  My intuition tells me that the real and imaginary parts of the 
correlation coefficients, which must lie inside the unit circle in the complex 
plane, actually tell you something significant about the nature of correlation 
in the real and imaginary parts of your two variables x and y.  Earlier you 
referred to a "spinning and stretching", and in all likelihood the location of a 
complex coefficient within that circle tells you something significant about 
the relative amounts of correlation in these two characteristics.

 If you write x = rx*exp(i*tx) and y = ry*exp(i*ty) where the r's and t's are 
real, in taking the covariance you are summing rx*ry*exp(i*(ty-tx)) over all 
the sample.  To get a correlation with an absolute value near 1 at a certain 
angle would indicate that x and y typically occurred with an approximately 
fixed amount of angle difference of that amount.

  It is up to you as to what role you wish your correlation coefficient to play in 
your analysis.

Roger Stafford