- sdr.upsample(x: ArrayLike, rate: int) NDArray
Upsamples the time-domain signal \(x[n]\) by the factor \(r\), by inserting \(r-1\) zeros between each sample.
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(); \ ...: sdr.plot.time_domain(x, sample_rate=sample_rate); \ ...: plt.title("Input signal $x[n]$"); ...: In [4]: plt.figure(); \ ...: sdr.plot.time_domain(y, sample_rate=sample_rate*4); \ ...: plt.title("Upsampled signal $y[n]$"); ...:
The spectrum of \(y[n]\) has 3 additional copies of the spectrum of \(x[n]\).
In [5]: plt.figure(); \ ...: sdr.plot.periodogram(x, fft=2048, sample_rate=sample_rate); \ ...: plt.xlim(-sample_rate*2, sample_rate*2); \ ...: plt.ylim(-100, 0); \ ...: plt.title("Input signal $x[n]$"); ...: In [6]: plt.figure(); \ ...: sdr.plot.periodogram(y, fft=2048, sample_rate=sample_rate*4); \ ...: plt.xlim(-sample_rate*2, sample_rate*2); \ ...: plt.ylim(-100, 0); \ ...: plt.title("Upsampled signal $y[n]$"); ...: