I am trying to emulate the SFO effect for OFDM system, I did it using linear interpolation as shown HERE . That can be explained as if I have the time domain signal $s_n$ representing the output of ifft (let’s ignore the noise and the guard interval), so the SFO can be inserted using linear interpolation. Below is the code I made for that, and the resulted rotated signal without compensating the SFO.
clc; clear all; close all;
n_sym = 10; % The number of symbols
N = 1024; % The symbole length
mod = 4; %the modulation order
len= n_sym* log2(mod)*N; %Lenght of whole data (N * Number of symbol* M)
%This part will generate binary vector as per length entered by user
data=floor(rand(1,log2(mod)*len)+0.5);
%Mapping of binary data
mapper_out = qammod(bi2de(reshape(data,[],log2(mod))), mod,'UnitAveragePower', true);
% Take the iFFt operation after S/P operation
sn = ifft(reshape(mapper_out,N,[]));
%===== Here using interpolation to add 1 ppm SFO =====
for sy = 1 : size(sn,2)
S_y = sn(:,sy); %Taking every symbol separatly
for nn = 1 : length(S_y)-1
X_te(nn) = S_y(nn) + (nn*(S_y(nn+1) - S_y(nn))/1e6); %Doing linear interpolation with 5ppm
end
X_te2(:,sy) = [S_y(1); X_te.']; %[x[1]; x[nn]]
end
out = fft(X_te2); out = out(:); %P/S
%===Calculate the BER
data_rec = qamdemod(out, mod);
b_rec = reshape(de2bi(data_rec,log2(mod)),[],1).';
[BER_1 Ratio_1] = biterr(b_rec(1:68),data(1:68))
%==========
figure;plot(real(out),imag(out),'b+');title('constellation with and without Sampling Frequency Offset'); hold on;
plot(real(mapper_out),imag(mapper_out),'r+','LineWidth',3);
The problem is that, when adding an SFO effect of 1 ppm, the signal is completely rotated as shown in the above figure, and the BER cannot be recovered at all as shown in the above code. However, when having 1 ppm SFO, it’s expected to have little bit similar constellation to the ideal signal, and the BER performance is supposed to be almost 0.
Update
Normally, the added SFO effect into the signal $x[n]$ as following:
$y\left [ n \right ] = x\left [ n \right ] + n \times \frac{x\left [ n + 1 \right ] - x\left [ n \right ]}{10^6}$
The dominator is $10^6$ means that 1 ppm is added. Assuming the length of the symbols is $N = 1024$ as I insert the SFO for each symbol alone, so the maximum added SFO will be $1024$ multiplied by the difference between $x[N]$ and $x[N-1]$.
On the other hand, if we can normalize the added SFO by $N$ to have the maximum added SFO 1ppm multiplied by the difference between $x[N]$ and $x[N-1]$, the above equation will be:
$y\left [ n \right ] = x\left [ n \right ] + n \times \frac{x\left [ n + 1 \right ] - x\left [ n \right ]}{N \times 10^6}$
Unfortunately, the rotation is still very big and the signal is completely deteriorated.