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

Andrew P. Lentvorski bsder at mail.allcaps.org
Wed Aug 28 19:27:08 CDT 2002

```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).

How do I calculate the error in *time*?

Calculating the voltage error between the two is reasonable.  Add
interpolated time points to voltage1 such that it has signals at all
voltage2 time points and vice versa.  Now you have two signal vectors
which have the same time points.  Calculate your favorite
error measure and enjoy.  Suggestions as to how to do this *quickly* are
welcomed.

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?

Thanks,
-a

```