DSPRelated.com
Forums

Help me with cross correlation, please.

Started by Manugal September 13, 2010
Hi!

I'm porting a little Matlab function in C language. My problems raise with
xcorr() function. I need to calculate raw correlation (without
normalization) between two vectors. I've found this code
http://local.wasp.uwa.edu.au/~pbourke/miscellaneous/correlate/ , but it
calculates only a normalized correlation coefficient. However, I've tried
to adjust it to calculate a raw correlation vector, but results are wrongs
(compared with Matlab). I've also made other trials (i.e. using
convolution), but all without success. I don't know what can I do. Isn't
there xcorr() source code?

P.S. : I'm completely newbie on DSP and signal theory
P.S.2: I need to calculate xcorr() without FFT (for the moment)

If you need any source code, ask for it.


On Sep 13, 8:36&#4294967295;am, "Manugal" <manugal83@n_o_s_p_a_m.yahoo.it> wrote:
> Hi! > > I'm porting a little Matlab function in C language. My problems raise with > xcorr() function. I need to calculate raw correlation (without > normalization) between two vectors. I've found this codehttp://local.wasp.uwa.edu.au/~pbourke/miscellaneous/correlate/, but it > calculates only a normalized correlation coefficient. However, I've tried > to adjust it to calculate a raw correlation vector, but results are wrongs > (compared with Matlab). I've also made other trials (i.e. using > convolution), but all without success. I don't know what can I do. Isn't > there xcorr() source code? > > P.S. : I'm completely newbie on DSP and signal theory > P.S.2: I need to calculate xcorr() without FFT (for the moment) > > If you need any source code, ask for it.
I don't do Matlab, but maybe these will help: definition and example of non-normalized cross-correlation: http://www.scribd.com/doc/25334405/The-Discrete-Fourier-Transform-Part-6-Cross-Correlation I think the above is so long that it might wrap-around. If so, just concatenate the following: http://www.scribd.com/doc/25334405/ (and) The-Discrete-Fourier-Transform-Part-6-Cross-Correlation There's also these for Matlab xcorr( ): http://www.mathworks.com/help/toolbox/signal/xcorr.html http://www.dsprelated.com/groups/matlab/show/3926.php Kevin McGee