# How to Emulate Sample Frequency Offset for OFDM in Matlab?

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?

thanks

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$$

• Thanks Dan, could you please describe to me how to do it in steps, I am a bit confused. – Amro Goneim Dec 25 '19 at 23:00
• What part are you confused about? How do to linear interpolation? – Dan Boschen Dec 25 '19 at 23:02
• 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 – Amro Goneim Dec 25 '19 at 23:10
• Yes just think with the sampling clock offset your sample position will “roll” accordingly between samples. – Dan Boschen Dec 25 '19 at 23:15