Re: Exponential fit question.
- To: mathgroup at smc.vnet.net
- Subject: [mg28043] Re: Exponential fit question.
- From: adam.smith at hillsdale.edu
- Date: Thu, 29 Mar 2001 03:24:10 -0500 (EST)
- References: <99pdg6$lft@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
I see quite a few problems with what you are asking.
The first is that in Excel I get an exponential fit to your data of:
y = 5.22289 Exp[0.03799 x] not 7.5 Exp[0.0034 x]
Also, looking at your data seems to suggest a linear function instead of an
exponential. Is there a particular reason to believe that it is exponential?
On the second, The Fit[] function is basically intended for polynomial fits.
Although the example in the Help Browser shows one with Sin[x], I would suggest
staying away from such functions.
If you know that the form is exponential you can linearize the equation by
taking the natural logarithm of both sides
Log[y] = Log[A*E^(B*x)] = Log[B] + A*x
Then you can fit a line to Log[y] vs. x.
In[1]:=
lndata = {{50, Log[22]}, {64, Log[62]}, {78, Log[122]}, {93, Log[269]}, {107,
Log[414]}, {122, Log[507]}, {136, Log[597]}};
In[2]:=
Fit[lndata, {1, x}, x]
Out[2]=
1.65305\[InvisibleSpace] + 0.0379875 x
In[3]:=
Exp[1.65305]
Out[3]=
5.22289
Which gives me the same result as Excel: y = 5.2289 E^(.03799 x)
Adam Smith
In article <99pdg6$lft at smc.vnet.net>, joe says...
>
>hello.
>
>I was wondering if someone could help me with the following problem.
>
>I am trying to perform an exponential fit to the following data
>{{x,y}}
>
>data
>={{50,22},{64,62},{78,122},{93,269},{107,414},{122,507},{136,597}}
>
>Fit[data,Exp[x],x]
>
>what I get is
>
>1.94272422061017735^-63 *E^x Which is not correct.
>
>With Excel I get 7.5*E^0.0034x which is correct.
>
>How can I do this with Mathematica ?
>
>Thanks.
>-Joseph.
>
>