Re: Message using FindFit with LevenbergMarquardt Method
- To: mathgroup at smc.vnet.net
- Subject: [mg125496] Re: Message using FindFit with LevenbergMarquardt Method
- From: Bill Rowe <readnews at sbcglobal.net>
- Date: Thu, 15 Mar 2012 00:35:51 -0500 (EST)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
On 3/14/12 at 12:41 AM, geraldine.oliveux at free.fr (geraldine oliveux) wrote: >I'm a new user of Mathematica. I'm trying to fit data to a model in >which I have one parameter. I try to determine this parameter by >Levenberg-Marquardt Method. I wrote the following lines : data = >{{0., 0.425}, {60.6, 0.224}, {91.2, 0.1314}, {119.4, 0.0716}, {150., >0.040}, {181.8, 0.0241}} u = t*(a*sqrt[e0])/2 x = >Tanh[t*(a*sqrt[e0])/2] Etac = e0*(1 - x^2) fit = FindFit[data, Etac, >a, t, Method -> "LevenbergMarquardt"] <error messages snipped> While FindFit is a fairly powerful routine that often finds the best fit parameters with no help, there are also a great many problems where you will need to supply some help. To make effective use of FindFit you really do need to look at the documentation. Pay particular attention to the Possible Issues section at the bottom of the documentation page that talks about starting values. For non-linear problems with special functions, good selection for starting values is often key. The default starting values are often not adequate and lead to the error messages you saw. Other things you can do is add constraints to the parameters so that FindFit will not try values that do not lead to real values using your model. Other documentation you should read and understand to use functions like FindFit effectively are the tutorials on constrained and unconstrained optimization. Links to these tutorials can be found at the bottom of the documentation page for FindFit