Fitting an exponential approach/asymptotic power law in R/Python -


how can fit data asymptotic power law curve or exponential approach curve in r or python?

my data shows the y-axis increases continuously delta (increase) decreases increase in x.

any appreciated.

using python, if have numpy , scipy installed, use curve_fit of thescipy package. takes user-defined function , x- y-values (x_values , y_values in code), , returns optimized parameters , covariance of parameters.

import numpy import scipy  def exponential(x,a,b):     return a*numpy.exp(b*x)  fit_data, covariance = scipy.optimize.curve_fit(exponential, x_values, y_values, (1.,1.)) 

this answer assumes have data one-dimensional numpy-array. convert data 1 of these, though.

the last argument contains starting values optimization. if dont supply them, there might problems in determining number of parameters.


Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -