Re: NonlinearFit
- To: mathgroup at smc.vnet.net
- Subject: [mg49876] Re: NonlinearFit
- From: Paul Abbott <paul at physics.uwa.edu.au>
- Date: Thu, 5 Aug 2004 09:20:38 -0400 (EDT)
- Organization: The University of Western Australia
- References: <ceqtcr$jrp$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
In article <ceqtcr$jrp$1 at smc.vnet.net>, Andrew_Pollock at rcomext.com
wrote:
> I'm trying to fit an exponential function to a set of data using the
> following command:
>
> << Statistics`NonlinearFit`
> NonlinearFit[Data,theta1 Exp[theta2 x],x,{theta1,theta2}]
>
> Data is the following table, where the right column is 3*Exp[.2*x]
>
> (Embedded image moved to file: pic13984.pcx)
>
> [contact the author to get the file - moderator]
>
> NonlinearFit returns (Embedded image moved to file: pic03027.pcx), which is
> clearly not 3*Exp[.2*x].
>
> I only have this problem when trying to fit exponential functions. Any
> suggestions?
<< Statistics`
data = Table[{x, 3 E^(0.2 x)}, {x, -3, 3, 0.5}]
NonlinearFit[data, a E^(b x), x, {a, b}]
In Version 5.0 you can use FindFit:
FindFit[%, a E^(b x), {a, b}, x]
In both cases the original functional form is recovered.
Cheers,
Paul
--
Paul Abbott Phone: +61 8 9380 2734
School of Physics, M013 Fax: +61 8 9380 1014
The University of Western Australia (CRICOS Provider No 00126G)
35 Stirling Highway
Crawley WA 6009 mailto:paul at physics.uwa.edu.au
AUSTRALIA http://physics.uwa.edu.au/~paul