Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- coding: utf-8 -*-
- # Importing the module pyplot from matplotlib
- import matplotlib.pyplot as plt
- # Variables for our circuit. V will be generated in code
- # and used for calculation of I
- R = 100
- I = []
- V = []
- # Function for generating voltages and calculating currents at those voltages
- def ramp_voltages():
- for voltage in range(1,10):
- V.append(voltage)
- I.append(voltage/R)
- # Function for plotting the findings.
- def plotter():
- plt.plot(V, I)
- plt.grid()
- plt.xlabel("Voltage [V]")
- plt.ylabel("Current [A]")
- plt.show()
- ramp_voltages()
- plotter()
Advertisement
Add Comment
Please, Sign In to add comment