%% Circular Cross-Correlation
% Generate two complex sequences. Use cconv to compute their circular cross-correlation. Flip and conjugate the second operand to comply with the definition of cross-correlation. Specify an output vector length of 7.

a = [1 2 2 1]+1i;
b = [1 3 4 1]-2*1i;
c = cconv(a,conj(fliplr(b)),7);

%
% Compare the result to the cross-correlation computed using xcorr.

cref = xcorr(a,b);
dif = norm(c-cref)

% Copyright 2015 The MathWorks, Inc.