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.errorbar(xa, y, xerr=0, yerr=y.std_dev, fmt='o')
plt.xlabel('V [V]')
plt.ylabel('R [Ohm]')
In [ ]:
In [ ]:
In [ ]: