- sdr.upsample(x: NDArray, rate: int) NDArray
Upsamples the time-domain signal \(x[n]\) by the factor \(r\).
Warning
This function does not perform any anti-aliasing filtering. The upsampled signal \(y[n]\) will have frequency components above the Nyquist frequency of the original signal \(x[n]\). For efficient polyphase interpolation (with anti-aliasing filtering), see
sdr.Interpolator
.See also
Examples¶
Upsample a complex exponential by a factor of 4.
In [1]: sample_rate = 100; \ ...: x = np.exp(1j * 2 * np.pi * 15 / sample_rate * np.arange(20)) ...: In [2]: y = sdr.upsample(x, 4) In [3]: plt.figure(figsize=(8, 4)); \ ...: sdr.plot.time_domain(x, sample_rate=sample_rate); \ ...: plt.title("Input signal $x[n]$"); \ ...: plt.tight_layout(); ...: In [4]: plt.figure(figsize=(8, 4)); \ ...: sdr.plot.time_domain(y, sample_rate=sample_rate*4); \ ...: plt.title("Upsampled signal $y[n]$"); \ ...: plt.tight_layout(); ...:
The spectrum of \(y[n]\) has 3 additional copies of the spectrum of \(x[n]\).
In [5]: plt.figure(figsize=(8, 4)); \ ...: sdr.plot.periodogram(x, fft=2048, sample_rate=sample_rate); \ ...: plt.xlim(-sample_rate*2, sample_rate*2); \ ...: plt.title("Input signal $x[n]$"); \ ...: plt.tight_layout(); ...: In [6]: plt.figure(figsize=(8, 4)); \ ...: sdr.plot.periodogram(y, fft=2048, sample_rate=sample_rate*4); \ ...: plt.xlim(-sample_rate*2, sample_rate*2); \ ...: plt.title("Upsampled signal $y[n]$"); \ ...: plt.tight_layout(); ...: