Code to calculate a cross correlation function for many scales

2 vues (au cours des 30 derniers jours)
tilfani oussama
tilfani oussama le 21 Mar 2018
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

Réponses (1)

tilfani oussama
tilfani oussama le 21 Mar 2018
this is the paper of reference, look at paragraph 2 Multiscale cross correlation

Community Treasure Hunt

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

Start Hunting!

Translated by