autocorrelation with matlab
autocorrelation with matlab
(OP)
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
RE: autocorrelation with matlab
Cheers
Greg Locock
New here? Try reading these, they might help FAQ731-376: Eng-Tips.com Forum Policies http://eng-tips.com/market.cfm?
RE: autocorrelation with matlab
Yes I did not put the entire code, for instance there is (before the loop):
n0=length(M);
Ndelay=1000;
As the brut-force is very slow I don't do it for all possible delays.
Otherwise, yes I'm new here as you said, please tell me if I am doing something wrong.
Thank you,
Antoine
RE: autocorrelation with matlab
http://jespertoftkristensen.com/JTK/Blog/Entries/2...
RE: autocorrelation with matlab
I also found this website useful when the task is really urgent homeworkhelponline.net