# How to fit exponential function which is not converging

I performed an experiment where I measured diffusion in a lipid bilayer. I performed the measurement by fluorescently labeling some molecules in the bilayer, and the irradiating them with light until they become nonfluorescent (bleached).

This results in a dark spot in the field of view which gradually regains fluorescence as time progresses.

The data here represents the normalized fluorescence recovery. at t = 0 we have no recovery so the value is zero. As time progresses the fluorescence recovery increases until about 70% of the initial value.

I am trying to fit the following two functions to my data. However they are not converging. For fitequation1, I can get convergence if I specify constraints. For fit equation2 I cannon get convergence. Any suggestions?

normalized = {0., 0.136813, 0.260859, 0.426885, 0.469779, 0.505445, 0.543104, \
0.566412, 0.579988, 0.595328, 0.617525, 0.644393, 0.647385, 0.665809, \
0.670076, 0.673314, 0.675727, 0.665924}

fitEquation = a (1 - Exp[-b t]) + c (1 - Exp[-d t]);
fitEquation2 = y0 + a (1 - Exp[-k t]);

soln = FindFit[
normalized, {fitEquation, {a > 0 , b > 0, c > 0, d > 0, a <= 1,
b <= 1, c <= 1 }}, {a, b, c, d}, t]
soln2 = FindFit[
normalized, {fitEquation2 , {y0 + a < 1,  k <= 1}}, {y0, a, k}, t]

-
It is not quite clear what are the sequence of times in your data. It should have the format {{time1, intensity1},{time2, intensity2},...}, otherwise Mma understands it as {{1, intensity1},{2, intensity2},...}. Did you have this latter case in mind? –  Alexei Boulbitch Apr 7 '14 at 13:09

You can try to improve it "by hand", as follows.

Assume that the model is like this: model = (a*(Exp[c*t] - 1))/(1 + b*Exp[c*t]) and assume that you have in mind that your data correspond to {{1, intensity1}, {2, intensity2},...} (see my comment above) and assume that norm is the name of your data.

Try the following:

    Clear[model, a, b, c];
model = (a*(Exp[c*t] - 1))/(1 + b*Exp[c*t]);
ff = FindFit[norm, model, {a, b, c}, t]


returning

(* {a -> 0.180745, b -> 0.276041, c -> 0.47336} *)


Then let us try this:

    Manipulate[

Show[{
ListPlot[norm, PlotStyle -> {Blue, PointSize[0.01]},
PlotRange -> {{0, 20}, {0, 0.7}}],
Plot[((a + da)*(Exp[(c + dc)*t] - 1))/(
1 + (b + db)*Exp[(c + dc)*t]) /. ff, {t, 0, 20}, PlotStyle -> Red]

}, Epilog ->
Inset[Mean[(# - (((a + da)*(Exp[(c + dc)*#] - 1))/(
1 + (b + db)*Exp[(c + dc)*#]) /. ff)) & /@ norm /.
x_ -> x^2], Scaled[{0.8, 0.2}]]], {da, -0.03, 0.03}, {db, -0.05,
0.05}, {dc, -0.1, 0.1}]


with this you may play with the values of parameters da, dband dc and watch the mean square error (in the corner of the screen). This: should appear on the screen. This does not bring too much, however. The variation of the mean square error is in the third position after comma. As much as I remember, the experimental method you use is itself not too precise. If I am right, it is not that much the problem of a model as that of the method that matters.

-
ff = FindFit[normalized, {fitEquation2}, {y0, a, k}, t]
Show[ListLinePlot@normalized, Plot[fitEquation2 /. ff, {t, 0, 20}, Evaluated -> True]]


-
can anything be done to tune the accuracy of the parameters for either equation? They don't look like they fit the data very well. –  olliepower Apr 7 '14 at 6:06
While that improves the appearance of the fit, what is the physical significance of the sin term? Is it possible to improve just the fit parameters themselves? –  olliepower Apr 7 '14 at 6:20