You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

11 lines
200 B

4 years ago
  1. from scipy.optimize import curve_fit
  2. def linear_model(x, a, b):
  3. y= a * x + b
  4. return y
  5. x = [0, 1, 2, 3, 4, 5]
  6. y = [15, 10, 9, 6, 2, 0]
  7. popt, pcov = curve_fit(linear_model, x, y)
  8. print(popt)