Re: Exponetial Fit
- To: mathgroup at christensen.cybernetics.net
- Subject: [mg1823] Re: Exponetial Fit
- From: hsh104 at psu.edu (Hein Hundal)
- Date: Thu, 3 Aug 1995 23:52:06 -0400
- Organization: CAC
In article <3ui5dj$231 at news0.cybernetics.net> crunch at s-cwis.unomaha.edu (John L. White) writes: > I have tried to do a exponetial fit to a list of data from a physics >experiment, but Mathematica does a terrible job when I do the following >command: >Exp[Fit[Log(data),{1,t},t]] Depending on what you mean by an exponential fit, there are some better ways. If you want to find the best fit of the form y = A Exp[B x], try logy[{x_,y_}] := {x, Log[y]} logpoints = Map[logy, points] //N Exp[Fit[logpoints, {1,x}, x]] This gives the correct answer for points = {{1, 3 Exp[2]}, {2, 3 Exp[4]}, {3, 3 Exp[6]}} (* f[x] = 3 Exp[2 x] *) If you want to find the best fit of the form y = A x^B, try logpoints = Map[logy, points] //N Exp[Fit[logpoints, {1, Log[x]}, x]] This gives the correct answer for points = {{1, 3}, {2, 12}, {3, 27}, {4, 48}} (* f[x] = 3 x^2 *) I hope that helps. - Hein Hundal