-3

I am fitting a function to a power law by using

def model_func(t, a, b, c):                                                         
    return a * np.exp(-b * t) + c  

opt_parms, parm_cov = sp.optimize.curve_fit(model_func, x1, y1, maxfev=1000)          
a,b,c = opt_parms

The fitted curve looks perfect, but how can I get the exact function printed (like y=a*b^x)?

Thanks in advance

Andrew Clark
  • 202,379
  • 35
  • 273
  • 306

1 Answers1

1

If you have your fit variables in a, b, and c, you can just print them…

print('y = {} * -{} t + {}'.format(a, b, c))
bdesham
  • 15,430
  • 13
  • 79
  • 123