Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations KootK on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

autocorrelation with matlab 1

Status
Not open for further replies.

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
 
Replies continue below

Recommended for you

Hello Greg,

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
 
Great link, thanks.

I also found this website useful when the task is really urgent homeworkhelponline.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor