Autocorrelation of data in a matrix
6 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi, How do I find the autocorrelation of data given in 2D matrix?
Eg: A matrix a(x,y) is given. I need to find the autocorrelataion w.r.t y.
Thanks in advance.
1 comentario
Image Analyst
el 18 de Feb. de 2013
Explain what you mean. Usually a 2D auto-correlation is done in both directions. Are you saying that you want correlation only vertically along the y axis?
Respuestas (1)
Youssef Khmou
el 18 de Feb. de 2013
Editada: Youssef Khmou
el 18 de Feb. de 2013
Hi Nida,
1) If you are talking about 2D Autocorrelation :You can use the function "xcorr2". example :
A=1.33*randn(40,40); % Bidimensional Gaussian process
y1=xcorr2(A);
y2=xcorr2(A,A); % y1 and y2 are the same ,
2) If you mean computing the autocorrelation of columns of matrix A(N,P) which means that you have P signals each of length N then :
*1) You can use "xcorr(A)" but you get a (2*N-1)xP² with autocorrelations and crosscorrelations of all P signals .
*2) You can only compute the autocorrelation of each signal using loop :
% given a matrix data A of size (n,p)
n=20;p=5; % you have 5 signals
A=randn(n,p); % data
C=zeros(2*n-1,p); % matrix containing 5 autocorrelations of 5 signals
for i=1:p
C(:,i)=xcorr(A(:,i));
end
1 comentario
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!