Created
February 11, 2022 14:50
-
-
Save scottralph/285a2a6d8822f070874b52de0da1a926 to your computer and use it in GitHub Desktop.
Charging of a RC Circuit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%matplotlib inline | |
import matplotlib.pyplot as plt | |
import numpy as np | |
import math | |
fig = plt.figure() | |
ax = plt.axes() | |
ax.set_xlim([0,4]) | |
ax.set_ylim([0,1]) | |
xs = np.array([x/1000.0 for x in range(0,4001)]) | |
ys = np.array([1.0 - math.exp(-x) for x in xs]) | |
ax.plot(xs, ys) | |
y1 = 1.0-math.exp(-1.0) | |
lx = [0.0, 1.0, 1.0] | |
ly = [y1, y1, 0] | |
plt.plot(lx,ly) | |
plt.title('Charging of a Capacitor') | |
plt.xlabel('Time (Tau)') | |
plt.ylabel('Voltage (Vc)') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment