Align two signals by delaying earliest signal
[
estimates
the delay D between the two input signals, Xa
,Ya
]
= alignsignals(X
,Y
)X
andY
,
and returns the aligned signals, Xa
and Ya
.
If Y
is delayed with respect
to X
, then D is positive,
and X
is delayed by D samples.
If Y
is advanced with respect
to X
, then D is negative,
and Y
is delayed by –D samples.
Delays in X
and Y
can
be introduced by prepending zeros.
[
keeps
the lengths of the aligned signals, Xa
,Ya
]
= alignsignals(X
,Y
,maxlag
,'truncate')Xa
and Ya
,
the same as those of the input signals, X
and Y
,
respectively.
If the estimated delay D is positive,
then D zeros are prepended to X
and
the last D samples of X
are
truncated.
If the estimated delay D is negative,
then –D zeros are prepended to Y
and
the last –D samples of Y
are
truncated.
Notes

To avoid assigning a specific value to maxlag
when
using the 'truncate'
option, set maxlag
to []
.
[1] Orfanidis, S.J., Optimum Signal Processing. An Introduction. 2nd Edition, PrenticeHall, Englewood Cliffs, NJ, 1996.