sdr.plot.time_domain[_ScalarType_co](x: ndarray[Any, dtype[_ScalarType_co]], *, sample_rate: float | None = None, centered: bool = False, offset: float = 0.0, ax: Axes | None = None, diff: 'color' | 'line' = 'color', **kwargs)
sdr.plot.time_domain[_ScalarType_co](t: ndarray[Any, dtype[_ScalarType_co]], x: ndarray[Any, dtype[_ScalarType_co]], *, sample_rate: float | None = None, centered: bool = False, offset: float = 0.0, ax: Axes | None = None, diff: 'color' | 'line' = 'color', **kwargs)

Plots a time-domain signal \(x[n]\).

Parameters:
t: ndarray[Any, dtype[_ScalarType_co]]

The time signal \(t[n]\). The units are assumed to be \(1/f_s\).

x: ndarray[Any, dtype[_ScalarType_co]]

The time-domain signal \(x[n]\).

sample_rate: float | None = None

The sample rate \(f_s\) of the signal in samples/s. If None, the x-axis will be labeled as “Samples”.

centered: bool = False

Indicates whether to center the x-axis about 0. This argument is mutually exclusive with offset.

offset: float = 0.0

The x-axis offset to apply to the first sample. The units of the offset are \(1/f_s\). This argument is mutually exclusive with centered.

ax: Axes | None = None

The axis to plot on. If None, the current axis is used.

diff: 'color' | 'line' = 'color'

Indicates how to differentiate the real and imaginary parts of a complex signal. If "color", the real and imaginary parts will have different colors based on the current Matplotlib color cycle. If "line", the real part will have a solid line and the imaginary part will have a dashed line, and both lines will share the same color.

**kwargs

Additional keyword arguments to pass to matplotlib.pyplot.plot().

Examples

Plot a square-root raised cosine (SRRC) pulse shape centered about 0.

In [1]: qpsk = sdr.PSK(4, phase_offset=45, sps=10, pulse_shape="srrc"); \
   ...: pulse_shape = qpsk.pulse_shape
   ...: 

In [2]: plt.figure(); \
   ...: sdr.plot.time_domain(pulse_shape, centered=True); \
   ...: plt.title("SRRC pulse shape");
   ...: 
../../_images/sdr_plot_time_domain_1.png

Plot an imaginary QPSK signal at 10 kS/s.

In [3]: symbols = np.random.randint(0, 4, 50); \
   ...: x = qpsk.modulate(symbols)
   ...: 

In [4]: plt.figure(); \
   ...: sdr.plot.time_domain(x, sample_rate=10e3); \
   ...: plt.title("SRRC pulse-shaped QPSK");
   ...: 
../../_images/sdr_plot_time_domain_2.png

Plot non-uniformly sampled data.

In [5]: t = np.array([0, 1, 2, 3, 5, 8, 13, 21, 34, 55]); \
   ...: x = np.random.randn(t.size)
   ...: 

In [6]: plt.figure(); \
   ...: sdr.plot.time_domain(t, x, marker="."); \
   ...: plt.title("Non-uniformly sampled data");
   ...: 
../../_images/sdr_plot_time_domain_3.png