calculating auto-correlation function of a matrix
13 views (last 30 days)
Show older comments
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
0 Comments
Accepted Answer
Honglei Chen
on 6 Jul 2016
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 Comments
Honglei Chen
on 7 Jul 2016
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.
More Answers (1)
Image Analyst
on 7 Jul 2016
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.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
