I am gathering data from a sensor, but the data gathering depends on a code running, so the timing is not precise to make it equally paced.

What I mean is this, the time it takes to do measurement #1 and #2 is not exactly the same between measurement #2 and #3 and so one.

I may have data like this:

value = 20 taken at t=0s
value = 21 taken at t=0.2s
value = 44 taken at t=0.44s
value = 22 taken at t=0.67s
value = 33 taken at t=0.9s
value = 32 taken at t=1.3s

As you can see the time between measurements is not exactly the same and can vary slightly.

The idea is to perform a Fourier Cosine Transform on the discreet values.

First question is:

  1. will this not equally time between the measurements affect the DCT?
  2. what can be done to "normalize" the data to have constant times?

1 Answer 1


All standard transforms in DSP (including Fourier transforms or Cosine transforms etc.) assume uniformly sampled (time, space or frequency) input data.

When your data is nonuniformly sampled, you cannot directly use the standard algorithms.

You should either convert them into uniform samples and then use the standard algorithms or use specific algorithms that work on nonuniform data directly.

For the conversion, look for non-uniform to uniform interpolators.

  • $\begingroup$ Thanks. I was suspecting that. Suppose all points of my data were spaced by 0.2 seconds. I do a Cosine transform. If the results of the cosine transform are the intensities of all frequencies what I am looking at? I mean, what is the frequency separation between the points of the cosine transform? $\endgroup$
    – Duck
    Commented Feb 8, 2019 at 18:46
  • $\begingroup$ Your sampling frequency is 5 Hz., hence your DCT frequency separation will be $5/(2N)$ with $N$ being the number of samples... $\endgroup$
    – Fat32
    Commented Feb 8, 2019 at 19:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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