calculating auto-correlation function of a matrix

Hi, How can I calculate autocorrelation of a complex matrix ? (applied on the first dimension) As far as I know xcorr() is only for vectors.
Thanks

 채택된 답변

Honglei Chen
Honglei Chen 2016년 7월 6일
Do you mean you want to compute autocorrelation for each column? If so, you can always use a for loop to do that, e.g.,
x = ones(10,2);
r = zeros(2*size(x,1)-1,size(x,2);
for m = 1:size(x,2)
r(:,m) = xcorr(x(:,m));
end
Or if you don't mind dealing with cell arrays, you can always do
x = ones(10,2);
r = arrayfun(@(n)xcorr(x(:,n),1:size(x,2),'UniformOutput',false);

댓글 수: 5

mosa mm
mosa mm 2016년 7월 6일
편집: mosa mm 2016년 7월 6일
Thanks Honglei for your answer. My matrix is: 17 x 300 , after autocorrelation I should have an output of 1 x 300. Because the matrix is complex, I am guessing it must be through conjugation and sum. But I don't know how to do it.
Can you help?
Thanks
It's not obvious to me what operation you want to do. There are many ways to output a 1x300 vector form a 17x300 matrix. Could you clarify how your correlation is defined?
mosa mm
mosa mm 2016년 7월 7일
편집: mosa mm 2016년 7월 7일
Dear Honglei, the attached photo is the way that I should implement autocorrelation. So there are complex number multiplication (complex conjugate) and a sum. The output of this operation must give a (1 x 300) matrix in my case. Thanks
the short version of the above formula:
Based on that information, if I treat each column as a signal, I can have a 33x300 matrix, not a 1x300 matrix, unless we are talking about a specific time lag.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Image Analyst
Image Analyst 2016년 7월 7일

0 개 추천

There is an xcorr2() and normxcorr2() that can handle 2-D matrices like a 17 x 300 matrix. Not sure about complex numbers though - I've never tried it with those, just with real numbers. For what it's worth, I've attached a demo.

카테고리

질문:

2016년 7월 5일

댓글:

2016년 7월 7일

Community Treasure Hunt

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

Start Hunting!

Translated by