MathGroup Archive 2012

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Message using FindFit with LevenbergMarquardt Method

  • To: mathgroup at smc.vnet.net
  • Subject: [mg125467] Re: Message using FindFit with LevenbergMarquardt Method
  • From: "Oleksandr Rasputinov" <oleksandr_rasputinov at ymail.com>
  • Date: Thu, 15 Mar 2012 00:25:44 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <jjpbao$p9l$1@smc.vnet.net>

On Wed, 14 Mar 2012 05:46:00 -0000, geraldine oliveux  
<geraldine.oliveux at free.fr> wrote:

> Hello,
>
> 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"]
>
> But it gives me the following message :
> FindFit::nrlnum: "The function value {0.,-0.224+0.425\ (1. -1.\
> Tanh[Times[<<2>>]]^2),-0.1314+0.425\ (1. -1.\
> Tanh[Times[<<2>>]]^2),-0.0716+0.425\ (1. -1.\
> Tanh[Times[<<2>>]]^2),-0.04+0.425\ (1. -1.\
> Tanh[Times[<<2>>]]^2),-0.0241+0.425\ (1. -1.\ Tanh[Times[<<2>>]]^2)}\
> \n is not a list of real numbers with dimensions {6} at {a} = {1.}. "
>
> What does it mean ? I think there is something I don't do well, and
> that it concerns the data declaration.
> Thank you in advance for your help,
> Best regards,
> G=E9raldine
>

sqrt should be Sqrt, and you need to include e0 as a parameter (unless you  
know a value for it, in which case you should specify that).

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, e0}, t, Method -> "LevenbergMarquardt"]



  • Prev by Date: Re: How can I make a sequence that includes lists?
  • Next by Date: Re: Button Behavior OnClick
  • Previous by thread: Re: Message using FindFit with LevenbergMarquardt Method
  • Next by thread: Re: Message using FindFit with LevenbergMarquardt Method