Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
420 views
in Technique[技术] by (71.8m points)

Fitting an exponential function on gnuplot

I have to fit a dataset to the function f(x) = B + f(0)*exp(-x/t)

I get an error saying 'undefined value during function evaluation'. I presume the error is in the following bit of code:

f0 = 9444
f(x)= b + f0*exp(-x/t)
fit f(x) 'dataset.txt' using 2 : 3 via b,t

Where have I gone wrong?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Probably the search for values of t hit t=0 and evaluation failed on a divide-by-zero error.

Try setting f(x) = b + f0 * exp(-x*t) instead. You can invert t after finding a solution.

However, if you are describing exponential decay as a function of time t then you have your variable names confusingly reversed. The more conventional way of writing this would be

 f(t) = b + f0 * exp(-x*t)

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...