www.gusucode.com > signal 案例源码程序 matlab代码 > signal/AlignASignalAndAPeriodicRepetitionOfItExample.m

    %% Align a Signal and a Periodic Repetition of It
% Align signal |Y| with respect to |X|, despite the fact that |Y| is a
% periodic repetition of |X|. Return the smallest possible delay.

% Copyright 2015 The MathWorks, Inc.


%%
% Create two signals, |X| and |Y|. |Y| consists of two copies of the
% nonzero portion of |X| separated by zeros. Align the two signals.

X = [0 1 2 3];
Y = [1 2 3 0 0 0 0 1 2 3 0 0];

[Xa,Ya,D] = alignsignals(X,Y)