Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #8949 > unrolled thread

maximize crosscorrelation

Started byalexxx <alexxx.magni@gmail.com>
First post2012-03-10 11:19 +0000
Last post2012-03-10 11:19 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  maximize crosscorrelation alexxx <alexxx.magni@gmail.com> - 2012-03-10 11:19 +0000

#8949 — maximize crosscorrelation

Fromalexxx <alexxx.magni@gmail.com>
Date2012-03-10 11:19 +0000
Subjectmaximize crosscorrelation
Message-ID<jjfdb7$80h$1@smc.vnet.net>
Hi guys, I hope somebody can help me with this.

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.

Typical datafile, containing both signals:
# time        V1           V2
6.25e-011 0.787938 0.845207
................................................................
4.25e-010 0.886294 0.883048


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];

then I defined the crosscorrelation thus:
cc[\[Tau]_] :=  Integrate[f1[t] * f2[t + \[Tau]], {t, a,b}]
with the time limits a and b where my functions are well defined.

Last, I believed that the plot of my cc[\[Tau]_] as a function of
varying offset would show a clear peak at the correct offset value,
but it isnt so.


So, understanding that I didnt understand a thing, I setup a mokeup
problem:
f1[t_] := Cos[t]*Exp[-t^2/20]; f2[t_] := Cos[t - 2]*Exp[-(t -
2)^2/20];
Print[Plot[{f1[t], f2[t]}, {t, -10, 10}, PlotRange -> All]];
cc[\[Tau]_] :=  Integrate[f1[t]*f2[t + \[Tau]], {t, -Infinity,
Infinity}]
Plot[cc[\[Tau]], {\[Tau], -3, 3}, Mesh -> All, PlotPoints -> 5,
MaxRecursion -> 1, PlotRange -> All]

and it clearly works (e.g. maximum at 2), so I guess that my problem
lies 1) in the discrete nature of my data, and 2) in the fact that my
data is defined in a finite, not infinite interval.

Any ideas about how to define this problem?

Thanks!

alessandro







[toc] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web