MathGroup Archive 2008

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

Search the Archive

Re: FindFit issue

  • To: mathgroup at smc.vnet.net
  • Subject: [mg86432] Re: FindFit issue
  • From: Duffy <duffy.tilleman at gmail.com>
  • Date: Tue, 11 Mar 2008 02:58:49 -0500 (EST)
  • References: <fr2mhj$o5h$1@smc.vnet.net>

On Mar 10, 3:04 am, t.du... at gmail.com wrote:
> Hi,
> I am trying to fit experimental data
>
> d = {{1000, 44.576*10^(-3)},
>   {600, 49.546*10^(-3)},
>   {800, 46.757*10^(-3)},
>   {400, 55.023*10^(-3)},
>   {200, 61.209*10^(-3)},
>   {10, 71.584*10^(-3)},
>   {100, 65.367*10^(-3)}}
>
> and model is:
>
> y = 0.072214 - a*Log[10, 1+b*x]
>
> but Mathematica after typing
>
> FindFit[d, 0.072214 - a*Log[10, 1 + b*x], {a, b}, x]
>
> return
>
> FindFit::nrlnum: The function value {-0.0226973-0.0208168 \
> \[ImaginaryI],<<5>>,-0.0282009-<<21>> \[ImaginaryI]} is not a list of
> \
> real numbers with dimensions {7} at {a,b} = {0.0152574,-1.99204}.
>
> {a -> 0.0152574, b -> -1.99204}
>
> (especialy value of "b" is really awful - negative number in Log)
>
> But I know, there is  Fit (calculated in Scientist) with coefficients
> a = 0.033706
> b = 0.0057934
>
> Can someone explain what I'm doing wrong?
>
> Best regards,
>
> T.D.

Try constraining your fit parameters and using appropriate starting
points.  I got a decent looking fit using:

y = 0.072214 - a*Log[10, 1 + b*x]
FindFit[d, {y, b > 0}, {{a, .02}, {b, .02}}, x]

output:
{a -> 0.0339414, b -> 0.00571289}

the {y, b > 0} tells mathematica to constrain b to positive values,
and the {{a, .02}, {b, .02}} tells it to start looking for a fit with
parameters a and b set to .02.  A good way to find reasonable starting
guesses is by using Manipulate, if you're familiar with that and
running version 6.

-Duffy Tilleman


  • Prev by Date: Re: Path to *.m file
  • Next by Date: Re: FindFit issue
  • Previous by thread: Re: FindFit issue
  • Next by thread: Re: FindFit issue