import matplotlib.pyplot as plt
import plotly.io as pio
import plotly.express as px
import plotly.offline as py
# For a 12 volt lamp
current = [0.05, 0.06, 0.07, 0.08, 0.09, 0.1, 0.11, 0.12, 0.13, 0.14, 0.14, 0.15, 0.16, 0.17, 0.17, 0.18, 0.18, 0.19, 0.20, 0.20, 0.21, 0.21, 0.22, 0.22]
potentialDifference = [0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5, 5.5, 6, 6.5, 7, 7.5, 8, 8.5, 9, 9.5, 10, 10.5, 11, 11.5, 12]
plt.plot(potentialDifference, current)
import plotly.io as pio
import plotly.express as px
import plotly.offline as py
--------------------------------------------------------------------------- ModuleNotFoundError Traceback (most recent call last) <ipython-input-2-aa4a316a9be1> in <module>() 1 import matplotlib.pyplot as plt ----> 2 import plotly.io as pio 3 import plotly.express as px 4 import plotly.offline as py 5 ModuleNotFoundError: No module named 'plotly'
The investigation into the IV graph of the filament lamp shows that it is a logarithmic relationship where as you add more potential difference the current has diminishing returns.
# For a red LED
redCurrent = [0, 0, 0.01, 0.06, 0.72, 3.3, 9.8, 16.3, 19.2]
redPotentialDifference = [0.5, 1, 1.5, 1.6, 1.7, 1.8, 1.9, 1.95, 1.97]
pyplot.plot(redPotentialDifference, redCurrent, color="red", alpha = 0.66)
# For a green LED
greenCurrent = [0, 0, 0, 0, 0.01, 0.08, 0.51, 2.48, 4.25, 7.2, 9.9, 11.6]
greenPotentialDifference = [0, 0.5, 1, 1.5, 1.7, 1.8, 1.9, 2, 2.1, 2.2, 2.3, 2.4]
plt.ylabel("current")
plt.xlabel("potential difference")
plt.plot(greenPotentialDifference, greenCurrent, color="green", alpha = 0.66)
[<matplotlib.lines.Line2D at 0x26114cc8670>]