version 1.0.0.0 (1.62 KB) by
G. Levin

Circular Cross Correlation function estimate.

CXCORR Circular Cross Correlation function estimates.

CXCORR(a,b), where a and b represent samples taken over time interval T which is assumed to be a common period of two corresponding periodic signals.

a and b are supposed to be length M row vectors, either real or complex.

[x,c]=CXCORR(a,b) returns the length M-1 circular cross correlation sequence c with corresponding lags x.

The circular cross correlation is:

c(k) = sum[a(n)*conj(b(n+k))]/[norm(a)*norm(b)];

where vector b is shifted CIRCULARLY by k samples.

The function doesn't check the format of input vectors a and b!

For circular covariance between a and b look for CXCOV(a,b) in

http://www.mathworks.com/matlabcentral/fileexchange/loadAuthor.do?objectType=author&objectId=1093734

Reference:

A. V. Oppenheim, R. W. Schafer and J. R. Buck, Discrete-Time Signal Processing, Upper Saddler River, NJ : Prentice Hall, 1999.

Author: G. Levin, April 2004.

G. Levin (2021). Circular Cross Correlation (https://www.mathworks.com/matlabcentral/fileexchange/4810-circular-cross-correlation), MATLAB Central File Exchange. Retrieved .

Created with
R13

Compatible with any release

**Inspired:**
Circular Statistics Toolbox (Directional Statistics), Fast Circular (Periodic) Cross Correlation

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

Start Hunting!Create scripts with code, output, and formatted text in a single executable document.

asmaa atalaaHow can I apply this code to find circular cross correlation between two images

EvenorNotice that you cycle b backwards, b(2) becomes b(1), while in cross-correlation the shift should be forwards - b(1) become b(1+1)=b(2). This might be because different conventions of definitions of cross-correlation. I use the one in Wikipedia:

(a star b)[n] = sum_k( a*[k] b[k+n] ).

Otherwise, nice code.

AlexandreVery nice!

Stanislavxn RuanAndrew BazykI'm also wondering why the mean of a and b are not subtracted. Please let me know if you can explain.

Abbas AhmedIf i want to use zadoff chu sequence is anyone knows how i can make it. if i donot want to use ltezadoffchu command

priya pwhy are you take the values (25,29,34) in zadoff sequenc(lte)

IrineI'm sorry, but I don't understand how it works too (about the means of a and b) can you give an example, please..

julienmy mistake ! ignore the preceding comment !

(row vectors..)

julienI'm surprised it is not working only for me.. I get that :

??? In an assignment A(I) = B, the number of elements in B and

I must be the same.

Error in ==> cxcorr at 30

c(k)=a*b';

.. what's is happening ?

Paul LinHow come the mean of a and b are not subtracted before divided by norm? I'm assuming the result is a normalized norm , please corect me if I'm wrong.

Steffen B.Very useful for my term project, thanks.

§õ ©_À·try it

m gNeil KingExcellent, this is exactly what i was looking for!!! Ive been trying to correlate optical field profiles and this is the best tool that ive found