Path: news.mathworks.com!not-for-mail 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$1@newscl01ah.mathworks.com> References: <kk1fn4$nrr$1@newscl01ah.mathworks.com> Reply-To: <HIDDEN> NNTP-Posting-Host: www-00-blr.mathworks.com Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: newscl01ah.mathworks.com 1365529933 11031 172.30.248.45 (9 Apr 2013 17:52:13 GMT) X-Complaints-To: news@mathworks.com NNTP-Posting-Date: Tue, 9 Apr 2013 17:52:13 +0000 (UTC) X-Newsreader: MATLAB Central Newsreader 1187260 Xref: news.mathworks.com comp.soft-sys.matlab:793087 "Matthew" wrote in message <kk1fn4$nrr$1@newscl01ah.mathworks.com>... > 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