필터 지우기
필터 지우기

Code to calculate a cross correlation function for many scales

조회 수: 1 (최근 30일)
tilfani oussama
tilfani oussama 2018년 3월 21일
편집: tilfani oussama 2018년 3월 21일
I would like to calculate a cross correlation function on many scales, in the file attached chapter 2 Multiscale correlation function. I don't know if the code here is the right one, i have some small differences with results in the paper. >> X=cumsum(x); %%integrate and set profile series
>> Y=cumsum(y);
>> X=transpose(X);
>> Y=transpose(Y);
>> N=length(X);
for n=3:150,
for i=1:N-n,
ind1=i;
ind2=i+n;
index=(ind1:ind2);
C0=polyfit(index, X(index),1);
C1=polyfit(index,Y(index),1);
fit0=polyval(C0,index);
fit1=polyval(C1,index);
Cov{n}(i)=(1/(n-1))*sum((X(index)-fit0).*(Y(index)-fit1));
CovX{n}(i)=(1/(n-1))*sum((X(index)-fit0).*(X(index)-fit0));
CovY{n}(i)=(1/(n-1))*sum((Y(index)-fit1).*(Y(index)-fit1));
end
CovXY(n)=(1/(N-n))*sum(Cov{n});
VarX (n)=(1/(N-n))*sum(CovX{n});
VarY (n)=(1/(N-n))*sum(CovY{n});
end
for j=1:150
rho (j)=CovXY(j)/sqrt(VarX(j).*VarY(j));
end

답변 (1개)

tilfani oussama
tilfani oussama 2018년 3월 21일
this is the paper of reference, look at paragraph 2 Multiscale cross correlation

카테고리

Help CenterFile Exchange에서 Correlation and Convolution에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by