I am studying the effect of sampling frequency offset on OFDM, and in order to emulate SFO, I have to slightly change the sampling rate of the signal. In order to have a +5ppm offset, I have to change the sampling rate (in Matlab) from 1 to 1.000005. I tried to use "y=resample(x,200001,200000)" in Matlab but apparently there is a limitation and I could not do it. How can I simulate an SFO? How can I use resample in this case?



1 Answer 1


You effectively want a interpolated waveform that is interpolated by 200,000 such that for each new sample with the 5 ppm offset you can select one additional offset to induce that time offset, for example

x[1], x[200,002], x[400,003], x[600,004]....

(Or equally one less if your sampling clock increased in frequency 5ppm).

One very simple approach to do this is to use linear interpolation to determine the value of each new sample given the adjacent two samples, or curve fitting to more adjacent samples using higher order polynomials which is what is done with detailed filter design approaches. If your waveform is sufficiently oversampled to start with, then a simple linear interpolation approach may be more than sufficient. (To assess this you could measure the error vector magnitude of the mid sample using linear interpolation compared to a resample by 2 and see if that error is less than your target SNR requirement).

With a 5ppm lower clock the new samples would be:

$$y[n]=x[n] + mod(n,200,000)(x[n+1]-x[n])/200000$$

For n as the index of the original N sample waveform 0 to N-1

For example, If the first 4 samples were

2, 5, 8, 11

First sample: 2

Second sample: $5+ 1(8-5)/200,000$

Third sample: $8+ 2(11-8)/200,000$

  • $\begingroup$ Thanks Dan, could you please describe to me how to do it in steps, I am a bit confused. $\endgroup$ Dec 25, 2019 at 23:00
  • $\begingroup$ What part are you confused about? How do to linear interpolation? $\endgroup$ Dec 25, 2019 at 23:02
  • $\begingroup$ I think now understand how to emulate SFO, I will oversample the signal by 200,000. Then I will select the first sample followed by x(1+n*200,001). Nice idea.. Thanks $\endgroup$ Dec 25, 2019 at 23:10
  • $\begingroup$ Yes just think with the sampling clock offset your sample position will “roll” accordingly between samples. $\endgroup$ Dec 25, 2019 at 23:15
  • 1
    $\begingroup$ @Sajjad please post new questions separately where you can further detail your expectations on what you calculate the rotation to be and share your measurements; you can add further details to what your question is so that myself or someone else here can hopefully clear up the confusion - thanks! $\endgroup$ Jun 21, 2022 at 1:41

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.