From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Using correlation to search for subvector within a binary time series (bitstream)
Date: Tue, 9 Apr 2013 17:52:13 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 14
Message-ID: <kk1kgd$aon$>
References: <kk1fn4$nrr$>
Reply-To: <HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: 1365529933 11031 (9 Apr 2013 17:52:13 GMT)
NNTP-Posting-Date: Tue, 9 Apr 2013 17:52:13 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: comp.soft-sys.matlab:793087

"Matthew" wrote in message <kk1fn4$nrr$>...
> I understand how the correlation between two time series is found.  I am wondering if it is possible to use a correlation method in order to find a particular sub-vector within a binary time series (e.g., a bitstream).
> For example, given a pseudo-random bitstream of length 1,500, say, can one use a correlation technique to see if the vector v = [1 1 1 1 0 1] appears somewhere in the bitstream?
> I am aware of Matlab's "find" function and its other built-in functions; I am curious to see if this approach is valid as well.  Thanks!
- - - - - - - - -
  Using correlation with something as discrete as a bitstream seems inappropriate to me.  Why not use a direct equality test?  Let row vectors u and v be the long and short time series, respectively.

 m = length(u);
 n = length(v);
 f = find(all(bsxfun(@eq,hankel(u(1:n),u(n:m)),v),2));
Roger Stafford