# régression linéaire chapitre 1 Incertitude-type import numpy as np import matplotlib.pyplot as plt t = np.array([0., 1., 2., 3., 4., 5., 6., 7., 8., 9., 10.]) U = np.array([2.016, 1.453, 1.025, 0.714, 0.516, 0.386, 0.263, 0.175, 0.149, 0.106, 0.057]) u_t = 0.2 u_U = 0.2 ln_U = np.log(U) u_ln_U = u_U / U a, b = np.polyfit(t, ln_U, 1) plt.figure() plt.errorbar(t, ln_U, xerr = u_t, yerr=u_ln_U, fmt='.') plt.plot(t, a*t + b, label='régression linéaire') plt.legend() plt.grid() plt.xlabel('t (s)') plt.ylabel('ln(U/1V)') plt.show() print('tau =', -1/a, 's')