-
sdr.sample_rate_offset(x: ArrayLike, offset: float, sample_rate: float =
1.0
) NDArray Applies a sample rate offset to the time-domain signal \(x[n]\).
Examples
Create a QPSK reference signal.
In [1]: psk = sdr.PSK(4, phase_offset=45); \ ...: s = np.random.randint(0, psk.order, 1_000); \ ...: x = psk.map_symbols(s) ...:
Add 10 ppm of sample rate offset.
In [2]: y = sdr.sample_rate_offset(x, 10e-6) In [3]: plt.figure(); \ ...: sdr.plot.constellation(x, label="$x[n]$", zorder=2); \ ...: sdr.plot.constellation(y, label="$y[n]$", zorder=1); \ ...: plt.title("10 ppm sample rate offset"); ...:
Add 100 ppm of sample rate offset.
In [4]: y = sdr.sample_rate_offset(x, 100e-6) In [5]: plt.figure(); \ ...: sdr.plot.constellation(x, label="$x[n]$", zorder=2); \ ...: sdr.plot.constellation(y, label="$y[n]$", zorder=1); \ ...: plt.title("100 ppm sample rate offset"); ...: