%% X and Y Are Matrices, and maxlag Is Not Specified
% Specify X and Y of the same size. finddelay works column-by-column.

X = [0 1 0 0;
     1 2 0 0;
     2 0 1 0;
     1 0 2 1;
     0 0 0 2];
Y = [0 0 1 0;
     1 1 2 0;
     2 2 0 1;
     1 0 0 2;
     0 0 0 0];
D = finddelay(X,Y)

%
% Repeat the computation, but now add an extra row of zeros as the second row of Y.

Y = [0 0 1 0;
     0 0 0 0;
     1 1 2 0;
     2 2 0 1;
     1 0 0 2;
     0 0 0 0];
D = finddelay(X,Y)

% Copyright 2015 The MathWorks, Inc.