Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #8985
| From | alexxx <alexxx.magni@gmail.com> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: maximize crosscorrelation |
| Date | 2012-03-13 08:01 +0000 |
| Organization | Steven M. Christensen and Associates, Inc and MathTensor, Inc. |
| Message-ID | <jjmut5$cdp$1@smc.vnet.net> (permalink) |
| References | <jjhq5j$ivq$1@smc.vnet.net> |
On 11 Mar, 10:10, Bill Rowe <readn...@sbcglobal.net> wrote:
> On 3/10/12 at 6:16 AM, alexxx.ma...@gmail.com (alexxx) wrote:
>
> >I have two similar signals s1 and s2, where one is shifted with
> >respect to the other by an unknown amount. These signals are
> >captured by an oscilloscope, so you can represent them as arrays of
> >{t,v} time and voltage values.
> >I always knew that the theory says in such cases you have to
> >maximize the selfcorrelation between the two signals, but I never
> >used it until now.
> >(BTW I was surprised to find that Mathematica had it as a standalone
> >function, but doesnt provide it anymore)
> >Anyway, 1st thing since crosscorr requires integration I defined the
> >interpolation functions f1= Interpolation[v1]; f2=
> >Interpolation[v2];
>
> For discrete data the function you want is ListCorrelate. For example,
>
> First generate a "signal" and the same signal with an offset:
>
> x = RandomReal[1, {20}];
> y = RotateLeft[x, 5];
>
> Now find the offset by:
>
> In[12]:= Ordering[
> Flatten@Table[ListCorrelate[RotateLeft[x, n], y], {n, 20}], -1]
>
> Out[12]= {5}
works perfectly, thanks a lot!
alessandro
Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Find similar | Unroll thread
Re: maximize crosscorrelation Bill Rowe <readnews@sbcglobal.net> - 2012-03-11 09:10 +0000 Re: maximize crosscorrelation alexxx <alexxx.magni@gmail.com> - 2012-03-13 08:01 +0000
csiph-web