gagio
Materials
- Jan 27, 2015
- 3
Hello,
I am trying to calculate the autocorrelation by using brut force to then compare it with xcorr.
I obtain a function that goes to 1 but it is extremely more noisy than with xcorr, I also loose all the interesting features. Does anyone know why ? I already spent a lot of time on it Thank you in advance !
Method:
I loop over the different delays and I multiply my two shifted signals. It look like (M is my signal):
for tau=1:1:Ndelay
n=n0-tau;
Id1=tau+1:n0;
Id2=1:n;
sig1=M(Id1);
sig2=M(Id2);
var=mean(sig1)*mean(sig2);
corre(tau)= mean(sig1.*sig2)/var;
end
I am trying to calculate the autocorrelation by using brut force to then compare it with xcorr.
I obtain a function that goes to 1 but it is extremely more noisy than with xcorr, I also loose all the interesting features. Does anyone know why ? I already spent a lot of time on it Thank you in advance !
Method:
I loop over the different delays and I multiply my two shifted signals. It look like (M is my signal):
for tau=1:1:Ndelay
n=n0-tau;
Id1=tau+1:n0;
Id2=1:n;
sig1=M(Id1);
sig2=M(Id2);
var=mean(sig1)*mean(sig2);
corre(tau)= mean(sig1.*sig2)/var;
end