import matplotlib.pyplot as plt # Digital data (could come from a logic analyzer, ADC, file, etc.) bool_array = [ True, False, True, True, False, False, True, False, False, True, True, True, False, False, True, False ] sample_rate = 3600 # samples per second time = [] voltage = [] for sample, bit in enumerate(bool_array): # create time axis t = sample / sample_rate # convert digital bit to voltage if bit: v = 1.0 else: v = 0.0 time.append(t) voltage.append(v) plt.figure(figsize=(10,4)) plt.step(time, voltage, where="post") plt.xlabel("Time (seconds)") plt.ylabel("Voltage (V)") plt.title("DSP Waveform From Boolean Array") plt.grid(True) plt.ylim(-0.2, 1.2) plt.show()