# Fitting of exponential data gives me a constant function [closed]

I conducted an experiment, where a capacitor is discharged over a (big) resistor for $t$ seconds and then the remaining charge is measured with a ballistic galvanometer. The data I have is:

t       phi
-----------
1.00    65
1.75    60
1.75    61
2.28    56
3.13    52
3.94    48
5.16    44
5.85    40
13.35   20


When I plot this data (gnuplot here) in a semilog plot, I get this:

As far as I can tell, those points lie on a straight line, which would then be an exponential function. And that is what I would expect as well, since this should be

$$Q(t) = Q_0 \exp\left(\frac{-t}{RC}\right)$$

However, when I fit it using this gnuplot snippet, I get fit parameters that make no sense to me.

f1(x) = a * exp(-x/g);
fit f1(x) "test.dat" using 1:2:3 via a,g


Yields:

Final set of parameters            Asymptotic Standard Error
=======================            ==========================

a               = 49.5555          +/- 7.647        (15.43%)
g               = -3.43204e+07     +/- 3.281e+13    (9.561e+07%)


I tried this same thing in Octave and Grace as well, they all give me this constant function.

How can I get a meaningful fit for this, other than trying to fit it by hand?

-

## closed as off topic by Qmechanic♦, Sklivvz♦, Manishearth♦Dec 29 '12 at 15:58

Questions on Physics Stack Exchange are expected to relate to physics within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

You could try a linear regression of ln(Q) versus t. – John Rennie Oct 18 '12 at 15:17
That worked. I am not sure why it works now … – Martin Ueding Oct 18 '12 at 15:24
I've never used gnuplot, but nonlinear functions are generally harder to fit than linear functions and unless you choose the starting point carefully the fit may not converge. – John Rennie Oct 18 '12 at 15:32
I'm not sure this is really on topic for us, but perhaps it could be migrated to Cross Validated or Computational Science. Thoughts? – David Z Oct 18 '12 at 17:19

I tried fitting your expression using the Excel Solver and got $Q_0$ = 71.1 and $1/RC$ = 0.0966. The resulting fit looked like:
I got $RC = 10$ with the linear fit of the logarithmic data, so that looks pretty good. I wonder how Excel can fit it, and the three tool I used failed … – Martin Ueding Oct 18 '12 at 18:58