# exponential with offset fitting

hegedus

Wed, 06/10/2020 - 10:22 am

Hi,

I have a simple data set that appears to be two parts, a linear region followed by a section that appears to be exponential. I have set cursors to delineate the region to fit with an exponential. Since it is an increasing exponential I have seeded the coefficients with some values, 0.1,0.1, and -0.001. Fit to an exponential is passable, but not great. When I try the same thing but substituting the exponential with offset as recommended it fails on iteration 1. I would actually prefer the offset version of the fit. What is amiss? The file is attached.

Andy

Andy-

Note that I took the implementation of exp_XOffset function as a chance to correct something that had annoyed me a great deal: the plain exp function fits 1/tau, whereas the exp_XOffset function fits tau directly. So I used -1000 as the initial guess for tau and it fit fine:

Fit converged properly

Curve fit with data subrange:

CellSwell[15,24]

fit_CellSwell= W_coef[0]+W_coef[1]*exp(-(x-W_fitConstants[0])/W_coef[2])

W_coef={-0.055232,0.07162,-569.33}

W_fitConstants={1221.5}

V_chisq= 4.84414e-05;V_npnts= 10;V_numNaNs= 0;V_numINFs= 0;

V_startRow= 15;V_endRow= 24;

W_sigma={0.0118,0.0103,46.2}

Coefficient values ± one standard deviation

y0 =-0.055232 ± 0.0118

A =0.07162 ± 0.0103

tau =-569.33 ± 46.2

Constant:

X0 =1221.45

June 10, 2020 at 01:12 pm - Permalink

Hi John,

Didn't see that coming. Thanks for the response. Also fitting exponentials, especially positive ones is tricky. Do you have any best practices/advice for seeding coefficients. My guess the ones you know have already been incorporated. Any guidance would be welcome.

Andy

June 10, 2020 at 01:17 pm - Permalink

As I think you have already figured out, automatic guessing doesn't work for growing exponentials. The /G flag you can see in my fit is the "manual guess" flag. I use the dialog and the Graph Now button to get something close. Most of the coefficients don't have to be particularly close- y0 and amplitude are linear coefficients and should be OK to be pretty far off. The decay constant needs to be moderately good- that is, the curvature should be an approximate match to the data. So the line doesn't have to actually go through the data, but it should look similar to the data.

And, of course, don't let a growing exponential grow too long :)

June 10, 2020 at 04:19 pm - Permalink