Skip to content

Instantly share code, notes, and snippets.

View friendtogeoff's full-sized avatar

Ed Colby friendtogeoff

View GitHub Profile
@friendtogeoff
friendtogeoff / fit_decay.py
Last active October 19, 2017 09:02
Computes an exponential fit to a series of data.
"""
compute an exponential decay fit to two vectors of x and y data
result is in form y = a + b * exp(c*x).
ref. https://gist.github.com/johanvdw/443a820a7f4ffa7e9f8997481d7ca8b3
"""
def exp_est(x,y):
n = np.size(x)
# sort the data into ascending x order
y = y[np.argsort(x)]
x = x[np.argsort(x)]