# Start writing code here...
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
TC_df = pd.read_csv('TinkerCad.csv')
TC_df
df = pd.read_csv('TinkerCad.csv')
Vps = df.Vps
Vpr = df.Vpr
R = 1000
I = (Vps - Vpr)/R
m, b = np.polyfit(I, Vpr, 1)
Vth = m*I +b
plt.title("Voltage vs. Current-Photoresistor Characteristics")
plt.xlabel("Resistor Current(A)")
plt.ylabel("Resistor Voltage(V)")
plt.plot(I, Vpr, 'b.', label='data')
plt.plot(I, Vth, 'r-', label='fit')
plt.legend()
LT_df = pd.read_csv('Project0.txt', delimiter='\t')
LT_df
df2 = pd.read_csv('Project0.txt',delimiter='\t')
Vps = df2['V(n001)']
Vpr = df2['V(n002)']
R = 1000
I = (Vps - Vpr)/R
m, b = np.polyfit(I, Vpr, 1)
Vth = m*I +b
plt.title("Voltage vs. Current-Photoresistor Characteristics")
plt.xlabel("Resistor Current(A)")
plt.ylabel("Resistor Voltage(V)")
plt.plot(I, Vpr, 'b.', label='data')
plt.plot(I, Vth, 'r-', label='fit')
plt.legend()