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 21:04:06 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 10
Message-ID: <kk1vo6$iv0$1@newscl01ah.mathworks.com>
References: <kk1fn4$nrr$1@newscl01ah.mathworks.com> <kk1mg3$hgg$1@newscl01ah.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: www-06-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: newscl01ah.mathworks.com 1365541446 19424 172.30.248.38 (9 Apr 2013 21:04:06 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 9 Apr 2013 21:04:06 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: news.mathworks.com comp.soft-sys.matlab:793107

"Bruno Luong" <b.luong@fogale.findmycountry> wrote in message <kk1mg3$hgg$1@newscl01ah.mathworks.com>...
> % Correlation
> c=conv(a,fliplr(v),'valid');
> p=conv(a, ones(size(v)),'valid');
> q=sum(v);
> idx = find(c.^2==p*q & c>0)
- - - - - - - - -
  That's very clever, Bruno.  Still, couldn't you get the same result with just one call on 'conv':

 idx = find(conv(a-1/2,fliplr(v-1/2),'valid')==length(v)/4);