Tripple correlation in MATLAB

4 次查看(过去 30 天)
Georgiy
Georgiy 2015-10-18
回答: Georgiy 2015-10-25
Hello, Till now I performed a cross correlation between 2 vectors A and B by using a xcorr(A,B) function. Now I have 3 vectors: A, B and C. How do I perform a triple correlation between them? Is it right to first correlate between two, and correlate the result with third one, like xcorr(xcorr(A,B),C)? Or there is a special function for triple correlation in MATLAB? Thanks!

回答(2 个)

Walter Roberson
Walter Roberson 2015-10-18
No, xcorr(xcorr(A,B),C) is going to correlate the correlation matrix with C.
Maybe
corrcoef([A(:),B(:),C(:)])
  1 个评论
Georgiy
Georgiy 2015-10-24
编辑:Georgiy 2015-10-24
Hi, Thanks for the answer. I tried it out, but I get a 2x2 matrix, while my signals are of 2,000,000 samples each. I wrote a code that does it by "multiplication and sum" method, but it takes a lot of time (weeks/months, I guess). Just checked what xcorr function does, and realized that maybe by "fft" method it will be faster. So the question is: xcorr takes 2 signals, performs fft on them and multiples first by conjugate of the second one and then fft back. Like:
a = first_signal;
b = second_signal;
corrLength=length(a)+length(b)-1;
c=fftshift(ifft(fft(a,corrLength).*conj(fft(b,corrLength))));
I tried to do it "manually" by the above algorithm for three signals. What I did is FFT each of the 3 signals, multiplicate A.B, which gives a row vector. Then I convert C row vector to C column vector by C' and multiplicate each column of A.B by C. Then iFFT2 back. Unfortunatelly I get a wrong result. The reason I convert C to a column vector is to get a matrix, since triple correlation is calculated according to 2 time delays, and obviously the result should be a matrix rather than a vector as in correlation of the 2 signals, where only a one time delay is present. Thanks in advance!

请先登录,再进行评论。


Georgiy
Georgiy 2015-10-25
Someone please?

Community Treasure Hunt

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

Start Hunting!

Translated by