fitting exponential decay with no initial guessing

前端 未结 8 925
刺人心
刺人心 2020-12-01 02:31

Does anyone know a scipy/numpy module which will allow to fit exponential decay to data?

Google search returned a few blog posts, for example - http://exnumerus.blo

8条回答
  •  囚心锁ツ
    2020-12-01 02:57

    I never got curve_fit to work properly, as you say I don't want to guess anything. I was trying to simplify Joe Kington's example and this is what I got working. The idea is to translate the 'noisy' data into log and then transalte it back and use polyfit and polyval to figure out the parameters:

    model = np.polyfit(xVals, np.log(yVals) , 1);   
    splineYs = np.exp(np.polyval(model,xVals[0]));
    pyplot.plot(xVals,yVals,','); #show scatter plot of original data
    pyplot.plot(xVals,splineYs('b-'); #show fitted line
    pyplot.show()
    

    where xVals and yVals are just lists.

提交回复
热议问题