MATLAB: Calculating auto-correlation function of a matrix

autocorrelationcomplex signaldigital image processing

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

Best Answer

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);
Related Question