import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
df = pd.read_csv ('LTspice Data', delimiter='\t')
df
df1 = pd.read_csv ('TinkerCADdata.csv')
df1
df.columns
Vps = df['V(n001)']
Vpr = df['V(n002)']
R = 1000
I = (Vps - Vpr)/R
m, b = np.polyfit(I, Vpr, 1)
Vth = m*I + b
plt.title("LTspice Simulation")
plt.xlabel("Current (Amps)")
plt.ylabel("Voltage Drop (Volts)")
plt.plot(I, Vpr, 'b.', label='data')
plt.plot(I, Vth, 'r-', label='fit')
plt.legend()
m
df1.columns
Vps = df1['V1']
Vpr = df1['V2']
R = 1000
I = (Vps - Vpr)/R
m, b = np.polyfit(I, Vpr, 1)
Vth = m*I + b
plt.title("TinkerCAD Simulation")
plt.xlabel("Current (Amps)")
plt.ylabel("Voltage Drop (Volts)")
plt.plot(I, Vpr, 'b.', label='data')
plt.plot(I, Vth, 'r-', label='fit')
plt.legend()
m