且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

用枢轴点拟合曲线Python

更新时间:2022-04-03 03:19:24

在日志空间中对模型进行可能的逐步参数化是这样的:

A possible stepwise parametrisation of your model in log-space is something like:

(x>q)*((x-q)*a)+(x<q)*((x-q)*c)+b

其中q是纽结的位置,ac是两个零件的斜率,b是全局y偏移.由于模型具有不连续性,因此基于梯度的最小化器可能不是找到***拟合的***选择.尽管如此,我同时尝试了scipy.optimize.leastsqscipy.odr并获得了良好的结果.

Where q is the position of the kink, a, and c are the slopes of both parts and b is a global y-offset. Since the model has a discontinuity a gradient based minimizer might not be the best choice to find a best fit. Nevertheless I tried both scipy.optimize.leastsq and scipy.odr and got good results.