# [SciPy-user] Error calculation in signals ...

Joe Reinhardt jmr at engineering.uiowa.edu
Thu Aug 29 17:43:19 CDT 2002

```You can do this with a cross-correlation.  You will need to resample
the data so they have the same sampling along the time axis.  Then the
peak(s) in the cross-correlation tells you how to shift one signal to
best match (align) it with the other.

- Joe

"Andrew P. Lentvorski" <bsder at mail.allcaps.org> writes:

> I have a question concerning how to calculate error in two signals.
>
> Consider a two voltage signals vs. time.  Both of these signals are
> roughly sinusoidal and can be described by a series of (time, voltage)
> pairs (or vectors, converting is easy).
>
...
> However, now I want to calculate the time error between the two signals.
> These are both sinusoids which are pretty close to the same signal, but
> not quite (one is from a later cycle and has a bit of noise).  How do I
> calculate the time error for each sample?  I could simply run a loop over
> each sample, find the two nearest bracketing points in voltage on the
> other signal, and then interpolate to find the time.  But that's going to
> take a *long* time.  Is there a faster/more mathematical way to do
> this?

```