在 gnuplot 中拟合分段函数

use*_*370 5 gnuplot function curve-fitting bounds fitbounds

我想在 gnuplot 中拟合多个有界函数,同时拟合边界值。

例如:

f(x)=a          (for x < b)

f(x)=a+(x-b)**c (for x > b)

fit f(x) 'data.dat' via a,b,c
Run Code Online (Sandbox Code Playgroud)

有没有办法做到这一点?

mgi*_*son 3

嗯...有趣。为什么不尝试以下方法:

f(x)=(x<b)?a:a+(x-b)**c
fit f(x) 'data.dat' via a,b,c
Run Code Online (Sandbox Code Playgroud)

由@george 测试(见评论)。谢谢乔治!