• I have two sensors attached to a vehicle
  • I have recorded the output of these two sensors (for example GPS) during a test ride
  • each sensor has a different frequency
  • one sensor is way more accurate than the other sensor

How do I compute the latency of the 'bad' sensor with respect to the 'good' sensor using the output data?

Example output data:


t (s) = 0, 1, ...

position (latitude, longitude) = (x_0, y_0), ...


t (s) = 0, 0.5, 1, ...

position (latitude, longitude) = (x_0, y_0), ...

I have considered cross-correlation, but I am not sure if it is applicable here.

  • $\begingroup$ Yes, cross-correlation is applicable. $\endgroup$ Jul 1, 2020 at 20:32

1 Answer 1


When you are working with non-real-time data you can resample the data to make it synchronous. A data point with less data than the desired frequency will by up-sampled, and a data point to more than the desired frequency will be down-sampled. You can think of the up-sampling code basically interpolating between two nearby coarse data points. Instead of linear interpolation however, it uses higher order polynomials to give more accurate results. My recommendation is to go the python route with either the SciPy or higher level Pandas libraries. Build off some example code and post on stackoverflow if you run into issues.

Once you have synchronous data you can start looking at resolving the delay discrepancies. How you go about this depends on what the other sensor is, how the delay is physically being created in the gps (reporting delay, noise, hysteresis), and what you are attempting to use the data for.

Good Luck!

Here are some links to get started:

  1. SciPy Resampling Syntax
  2. SciPy Resampling Examples
  3. Pandas Resampling Overview
  4. Pandas Resampling Syntax
  5. Matlab Resampling Overview
  6. Matlab Resampling Syntax

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.