%% Circular Convolution and Linear Convolution
% Generate two signals of different lengths. Compare their circular convolution and their linear convolution. Use the default value for n.

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

dif = norm(c-cref)

% The resulting norm is virtually zero, which shows that the two convolutions produce the same result to machine precision.
% Copyright 2015 The MathWorks, Inc.