Tripple correlation in MATLAB

3 views (last 30 days)
Georgiy
Georgiy on 18 Oct 2015
Answered: Georgiy on 25 Oct 2015
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!

Answers (2)

Walter Roberson
Walter Roberson on 18 Oct 2015
No, xcorr(xcorr(A,B),C) is going to correlate the correlation matrix with C.
Maybe
corrcoef([A(:),B(:),C(:)])
  1 Comment
Georgiy
Georgiy on 24 Oct 2015
Edited: Georgiy on 24 Oct 2015
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!

Sign in to comment.


Georgiy
Georgiy on 25 Oct 2015
Someone please?

Community Treasure Hunt

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

Start Hunting!