Search code examples
gnuplotfunction-fitting

Gnuplot fitting


I want to fit the following data:

70  0.0429065
100 0.041212
150 0.040117
200 0.035018
250 0.024366
300 0.02017
350 0.018255
400 0.015368

to the following function which is combination of an exponantial and a gaussian functions:

$ f(x)= a1*(a2* exp(-x/T2e)+ exp(-(x/T2g)**2))

$ fit f(x) 'data' via a1,a2,T2e,T2g

But it keeps giving me the following results:

a1              = 0.0720021        +/- 0.04453      (61.84%)
a2              = 0.310022         +/- 0.9041       (291.6%)
T2e             = 63291.7          +/- 2.029e+07    (3.206e+04%)
T2g             = 252.79           +/- 32.36        (12.8%)

While when I try to fit it separetly to

$ g(x)=b* exp(-(x/T2g)**2)

$ fit g(x) 'data' via b,T2g

I get

b               = 0.0451053        +/- 0.001598     (3.542%)
T2g             = 359.359          +/- 16.89        (4.701%)

and

$ S(x)=S0* exp(-x/T2e)

$ fit S(x) 'data' via S0,T2e

gives:

S0              = 0.057199         +/- 0.003954     (6.913%)
T2e              = 319.257          +/- 38.17        (11.96%)

I already tried to set the initial values but it didn't change the results.

Does anybody know what is wrong? Thank you,


Solution

  • Ok, you can see an exponential decay with a hump which could be a Gaussian. The approach, how I got to a fit: first, exclude the datapoints 100 and 150 and fit the exponental and then set a Gaussian approximately at 170. You probably don't get a good fit, because at least the Gaussian peak is shifted by some value x1.

    With the code:

     ### fitting 
    reset session
    
    $Data <<EOD
    70  0.0429065
    100 0.041212
    150 0.040117
    200 0.035018
    250 0.024366
    300 0.02017
    350 0.018255
    400 0.015368
    EOD
    
    a = 0.055
    T2e = 310
    
    b = 0.008
    x1 = 170
    T2g = 54
    
    Exponential(x) = a*exp(-x/T2e)
    Gaussian(x) = b*exp(-((x-x1)/T2g)**2)
    
    f(x) = Exponential(x) + Gaussian(x)
    fit f(x) $Data u 1:2 via a,b,x1,T2e,T2g
    
    plot $Data u 1:2 w lp pt 7, f(x) lc rgb "red"
    ### end of code
    

    You'll get:

    a               = 0.0535048        +/- 0.00183      (3.42%)
    b               = 0.00833589       +/- 0.001006     (12.06%)
    x1              = 170.356          +/- 5.664        (3.325%)
    T2e             = 315.114          +/- 12.94        (4.106%)
    T2g             = 54.823           +/- 12.13        (22.12%)
    

    enter image description here