calculating auto-correlation function of a matrix

13 vues (au cours des 30 derniers jours)
mosa mm
mosa mm le 5 Juil 2016
Commenté : Honglei Chen le 7 Juil 2016
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

Réponse acceptée

Honglei Chen
Honglei Chen le 6 Juil 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 commentaires
mosa mm
mosa mm le 7 Juil 2016
the short version of the above formula:
Honglei Chen
Honglei Chen le 7 Juil 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.

Connectez-vous pour commenter.

Plus de réponses (1)

Image Analyst
Image Analyst le 7 Juil 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.

Community Treasure Hunt

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

Start Hunting!

Translated by