1from lcapy import Vdc, R, L, C 2import numpy as np 3from matplotlib.pyplot import figure, savefig, show 4 5a = (Vdc(5) + L(10)) | R(5) 6b = Vdc(5) + L(10) + R(5) 7 8t = np.linspace(0, 10, 1000) 9 10fig = figure() 11ax = fig.add_subplot(111) 12# Voltage across R 13ax.plot(t, a.V.impulse_response(t), linewidth=2) 14ax.set_xlabel('Time (s)') 15ax.set_ylabel('Voltage (V)') 16ax.grid(True) 17 18 19fig = figure() 20ax = fig.add_subplot(111) 21# Current through R 22ax.plot(t, b.I.impulse_response(t), linewidth=2) 23ax.set_xlabel('Time (s)') 24ax.set_ylabel('Current (A)') 25ax.grid(True) 26 27show() 28