Consider now measuring the value of a resistor by passing a current through it and measuring the voltage across it.

In [9]:
import matplotlib.pyplot as plt
import uncertainties as unc
import numpy as np
import math


for i in range(1,102,5): 
    ia = unc.ufloat(i/100, 0.01+i/100*0.05)
    ra = unc.ufloat(10,0)
    va = ra*ia
    verr = unc.ufloat(0, 0.0+va.n*0.01)
    rm = (va+verr) / ia
    vplot = va+verr
    
    plt.errorbar(vplot.nominal_value, rm.nominal_value, xerr=vplot.std_dev, yerr=rm.std_dev, fmt='o')


plt.xkcd()  # Yes...

#plt.scatter(x,y)
#plt.errorbar(xa, y, xerr=0, yerr=y.std_dev, fmt='o')
#plt.axis([0,100,0,200])
plt.xlabel('V [V]')
plt.ylabel('R [Ohm]')
plt.show()
In [ ]:
 
In [ ]:
 
In [ ]: