一切从头开始。
示例
import numpy as np import matplotlib.pyplot as plt x_val = np.linspace(0,10,100) A = 2.5 b = -5 y_real = A * x_val + b y_val = y_real + np.random.normal(0,1,100) plt.plot(x_val,y_val,'o',label = 'Data') plt.plot(x_val,y_real,'r-',label = 'Best fit Line',linewidth = 3) plt.legend(loc = 'upper left') plt.show()



