MathGroup Archive 2008

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

Search the Archive

Re: FindFit issue

  • To: mathgroup at smc.vnet.net
  • Subject: [mg86449] Re: [mg86395] FindFit issue
  • From: Bob Hanlon <hanlonr at cox.net>
  • Date: Tue, 11 Mar 2008 03:01:59 -0500 (EST)
  • Reply-to: hanlonr at cox.net

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)}};

model = 0.072214 - a*Log[10, 1 + b*x];

Constrain the value of b

param = FindFit[d, {model, 0 < b < 0.01}, {a, b}, x]

{a -> 0.0381336204825204, 
   b -> 0.004571110864366514}

f[x_] = model /. param

0.072214-0.0165612 log(0.00457111 x+1)

Note that the Log in the definition of f is base e vice base 10.

LogLinearPlot[f[x], {x, 10, 1000}, 
 Epilog -> {Red, AbsolutePointSize[4], Point[{Log[#[[1]]], #[[2]]}] & /@ d}]


Bob Hanlon

---- t.dubaj 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.
> 
> 
> 



  • Prev by Date: RE: Re: symbolize in v.6
  • Next by Date: Re: Re: Re: Assignment problem
  • Previous by thread: Re: FindFit issue
  • Next by thread: Re: How to use Thread when second argument to function is