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.
13 lines
232 B
13 lines
232 B
import matplotlib.pyplot as plt
|
|
from scipy.optimize import curve_fit
|
|
|
|
def linear_model(x, a, b):
|
|
y= a * x + b
|
|
return y
|
|
|
|
x = [0, 1, 2, 3, 4, 5]
|
|
y = [15, 10, 9, 6, 2, 0]
|
|
|
|
popt, pcov = curve_fit(linear_model, x, y)
|
|
|
|
print(popt)
|