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

Illustration
Teagan - 2021-01-14T15:22:15+00:00
Question: Is there a function that calculates circular cross-correlation of sequences?

I know that XCORR calculates linear cross-correlation function estimates, but I wonder if there is a function that calculates circular correlation.

Expert Answer

Profile picture of Kshitij Singh Kshitij Singh answered . 2025-11-20

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);
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)));


Not satisfied with the answer ?? ASK NOW

Get a Free Consultation or a Sample Assignment Review!