Is there a function that calculates circular cross-correlation of sequences?

84 views (last 30 days)
I know that XCORR calculates linear cross-correlation function estimates, but I wonder if there is a function that calculates circular correlation.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 7 May 2018
If you have the Signal Processing Toolbox, you can use the CCONV function to calculate the circular cross-correlation of two sequences.
The following example from the documentation for CCONV (link below) calculates a circular cross-correlation of two sequences:
a = [1 2 2 1]+1i;
b = [1 3 4 1]-2*1i;
c = cconv(a,conj(fliplr(b)),7);
https://www.mathworks.com/help/signal/ref/cconv.html#buzbj12
Note that this function was introduced in R2007a. For previous versions, you would need to implement a custom function in order to compute the circular cross-correlation.
If you do not have the Signal Processing Toolbox, you could also calculate the circular cross-correlation using the FFT function using the following syntax:
circcorr_ab = ifft(fft(a).*conj(fft(b)));

More Answers (0)

Products


Release

R2007b

Community Treasure Hunt

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

Start Hunting!