Re: maximize crosscorrelation

• To: mathgroup at smc.vnet.net
• Subject: [mg125407] Re: maximize crosscorrelation
• From: alexxx <alexxx.magni at gmail.com>
• Date: Tue, 13 Mar 2012 03:00:57 -0500 (EST)
• Delivered-to: l-mathgroup@mail-archive0.wolfram.com
• References: <jjhq5j\$ivq\$1@smc.vnet.net>

```On 11 Mar, 10:10, Bill Rowe <readn... at sbcglobal.net> wrote:
> On 3/10/12 at 6:16 AM, alexxx.ma... at 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

```

• Prev by Date: Re: pole/zero plot for TransferFunctionModel in the control system package?
• Next by Date: Re: Non linear model fitting with an integral model
• Previous by thread: Re: maximize crosscorrelation
• Next by thread: Textures with AlphaChannel not working on OS X system