I've just learned that the A/D converter I am using is not sampling at my desired sampling rate. I request 20 seconds of data at 1920Hz and I receive 38400 points of data that were actually sampled at 1920.93Hz.

So for example, if I sample a 30Hz sine wave and chop the signal up into 300 sections, the phase of the sine wave in section 1 differs from the sine wave in section 300. If my sampling rate was 1920Hz, as expected, the phase of each section would line up perfectly.

Now, to correct for this, is there any way of processing the signal such that it appears as if it was sampled at the correct sampling rate through interpolation or other means?


marked as duplicate by Jason R, jojek, Dilip Sarwate, Peter K. Aug 2 '14 at 1:18

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    $\begingroup$ Is the phase shifting by a constant amount each section? One explanation is that sample rate is .093 Hz off, another explanation is that you 30 Hz isn't stable. $\endgroup$ – MSalters Jul 24 '14 at 21:10
  • $\begingroup$ Hmm, mathworks.com/help/signal/ref/resample.html or mathworks.com/matlabcentral/answers/…. If you need your own implementation, look at fractional resamplers and polyphase filters. Full-scale interpolation and decimation are too computationally complex and unuseful. Polyphase filter allows you to avoid this problem. So it's possible and quite common problem $\endgroup$ – Serj Jul 25 '14 at 3:05
  • $\begingroup$ On the ADC, have you checked the tolerance of your crystal - 100ppm is quite common (1Hz in 10KHz). These do vary over temperature. Even more so if you are using the ADC's internal oscillator. Consider a TCXO or, if absolutely required, an OCXO for your next hardware revision. $\endgroup$ – Damien Jul 27 '14 at 1:53

Assuming the signal was reasonably band-limited before sampling, you can just use a high quality interpolation, such as a Sinc interpolation kernel, to calculate new equally spaced points at any lower density.

For small frequency deltas, even a long interpolation kernel or high degree polynomial interpolation can be a lot more efficient than naively upsampling and then downsampling.


I would have rather this be a comment but due to a lack of reputation I cannot do such.
Anyways I all wanted to say was:
Instead of worrying about how to resample the data just yet, have you tried correcting your code or investigating why you are getting too much data? I do not know of any ADC where you just "tell" it to give you n amount of seconds worth of data at a frequency. There is more to it than that. Could you post more details about the ADC and code that reads data from the ADC?


You can attack this in 2 approaches:

  1. Interpolation.
  2. Resample.


Build a new time grid as you wish and use Kernel to interpolate data.
Since you need to make a small change even a Linear Interpolation should work very well.


You can use Upsample and then Downsample to have any rational sampling rate you want.

For example, upsample by a factor of 192000 and then downsample by 192093 to get the sampling rate you wanted.

Have a look here: http://cnx.org/content/m10448/latest/


MATLAB Function: http://www.mathworks.com/help/signal/ref/resample.html

It will be much less efficient than Interpolation.


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