# # numpy : polyfit # Vincent Legat - 2018 # Ecole Polytechnique de Louvain # from numpy import * import matplotlib from matplotlib import pyplot as plt matplotlib.rcParams['toolbar'] = 'None' plt.rcParams['figure.facecolor'] = 'silver' plt.figure("Polynomial interpolation") X = [ -55, -45, -35, -25, -15, -5, 5, 15, 25, 35, 45, 55, 65] U = [ 3.25, 3.37, 3.35, 3.20, 3.12, 3.02, 3.02, 3.07, 3.17, 3.32, 3.30, 3.22, 3.10] a = polyfit(X,U,size(X)-1) x = linspace(X[0],X[-1],1000) uh = polyval(a, x) plt.plot(x,uh) plt.plot(X,U,'or') plt.show()