Products & Services Industries Academia Support User Community Company

Learn more about Signal Processing Toolbox   

cconv - Modulo-N circular convolution

Syntax

c = cconv(a,b,n)

Description

Circular convolution is used to convolve two discrete Fourier transform (DFT) sequences. For very long sequences, circular convolution may be faster than linear convolution.

c = cconv(a,b,n) circularly convolves vectors a and b. n is the length of the resulting vector. If you omit n, it defaults to length(a)+length(B)-1. When n = length(a)+length(B)-1, the circular convolution is equivalent to the linear convolution computed with conv. You can also use cconv to compute the circular cross-correlation of two sequences (see the example below).

Examples

The following example calculates a modulo-4 circular convolution.

a = [2 1 2 1];
b = [1 2 3 4];
c = cconv(a,b,4)

c =
    14    16    14    16  

The following example compares a circular correlation, where n uses the default value, and a linear convolution. The resulting norm is a value that is virtually zero, which shows that the two convolutions produce virtually the same result.

a = [1 2 -1 1];
b = [1 1 2 1 2 2 1 1];
c = cconv(a,b) 					% Circular convolution
cref = conv(a,b)				% Linear convolution
norm(c-cref)	

ans =
  9.7422e-016
 

The following example uses cconv to compute the circular cross-correlation of two sequences. The result is compared to the cross-correlation computed using xcorr.

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

c =

  Columns 1 through 5
  -1.0000 + 3.0000i   2.0000 +11.0000i   7.0000 +18.0000i
   8.0000 +21.0000i   6.0000 +18.0000i

  Columns 6 through 7
   1.0000 +10.0000i  -1.0000 + 3.0000i

cref =

  Columns 1 through 5
  -1.0000 + 3.0000i   2.0000 +11.0000i   7.0000 +18.0000i
   8.0000 +21.0000i   6.0000 +18.0000i

  Columns 6 through 7
   1.0000 +10.0000i  -1.0000 + 3.0000i

References

[1] Orfanidis, S.J., Introduction to Signal Processing, Englewood Cliffs, NJ: Prentice-Hall, Inc., 1996. pp. 524–529.

See Also

conv

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS