- sdr.to_real_pb(x_c: NDArray[complex_]) NDArray[float_]
Converts the complex baseband signal \(x_c[n]\) centered at \(0\) with sample rate \(f_{s,c}\) to a real passband signal \(x_r[n]\) centered at \(f_{s,r}/4\) with sample rate \(f_{s,r} = 2f_{s,c}\).
- Parameters:¶
- x_c: NDArray[complex_]¶
The complex baseband signal \(x_c[n]\) centered at \(0\) with sample rate \(f_{s,c}\).
- Returns:¶
The real passband signal \(x_r[n]\) centered at \(f_{s,r}/4\) with sample rate \(f_{s,r} = 2f_{s,c}\).
Examples¶
Create a complex baseband signal with frequency components at -150, 0, and 50 Hz, at a sample rate of 500 sps. Notice the spectrum is asymmetric.
In [1]: sample_rate = 500; \ ...: x_c = ( \ ...: 0.1 * np.exp(1j * 2 * np.pi * -150 / sample_rate * np.arange(1000)) \ ...: + 1.0 * np.exp(1j * 2 * np.pi * 0 / sample_rate * np.arange(1000)) \ ...: + 0.5 * np.exp(1j * 2 * np.pi * 50 / sample_rate * np.arange(1000)) \ ...: ); \ ...: x_c = sdr.awgn(x_c, snr=30) ...: In [2]: plt.figure(figsize=(8, 4)); \ ...: sdr.plot.time_domain(x_c[0:50], sample_rate=sample_rate); \ ...: plt.title("Time-domain signal $x_c[n]$"); \ ...: plt.tight_layout(); ...: In [3]: plt.figure(figsize=(8, 4)); \ ...: sdr.plot.periodogram(x_c, fft=2048, sample_rate=sample_rate); \ ...: plt.title("Periodogram of $x_c[n]$"); \ ...: plt.tight_layout(); ...:
Convert the complex baseband signal to a real passband signal with sample rate 1 ksps and center of 250 Hz. Notice the spectrum is now complex-conjugate symmetric. The complex exponentials are now real sinusoids at 100, 250, and 300 Hz.
In [4]: x_r = sdr.to_real_pb(x_c); \ ...: sample_rate *= 2 ...: In [5]: plt.figure(figsize=(8, 4)); \ ...: sdr.plot.time_domain(x_r[0:100], sample_rate=sample_rate); \ ...: plt.title("Time-domain signal $x_r[n]$"); \ ...: plt.tight_layout(); ...: In [6]: plt.figure(figsize=(8, 4)); \ ...: sdr.plot.periodogram(x_r, fft=2048, sample_rate=sample_rate); \ ...: plt.title("Periodogram of $x_r[n]$"); \ ...: plt.tight_layout(); ...: