MathGroup Archive 2004

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

Search the Archive

Re: NonlinearFit problem

  • To: mathgroup at smc.vnet.net
  • Subject: [mg52055] Re: [mg52033] NonlinearFit problem
  • From: DrBob <drbob at bigfoot.com>
  • Date: Tue, 9 Nov 2004 01:36:40 -0500 (EST)
  • References: <200411080813.DAA07880@smc.vnet.net>
  • Reply-to: drbob at bigfoot.com
  • Sender: owner-wri-mathgroup at wolfram.com

Here's the Jacobian of f with respect to {a,b}:

jac = Outer[D[f, ##1] & , {a, b}, {a, b}]

{{(r^a*Log[r]^2)/E^(b*r),
    (-E^((-b)*r))*r^(1 + a)*
     Log[r]}, {(-E^((-b)*r))*
     r^(1 + a)*Log[r],
    r^(2 + a)/E^(b*r)}}

Notice the appearance Log[r], which is undefined for r == 0, which occurs at the first data point.

Leaving that point out, we do get a solution:

data = {{0, 1.00002},
     {2.31507, 26.4522},
     {4.32033, 56.8265},
     {6.63539, 59.6674},
     {8.64066, 39.5536},
     {10.9557, 21.6862},
     {12.961, 10.1456},
     {15.276, 4.39652}};
f = r^a*Exp[(-b)*r];
NonlinearFit[Rest[data], f, r, {a, b}]
r^5.509926608585867/  E^(0.9448215835344381*r)

Consider this, too:

f /. r -> 0

0^a

There's no way to fit that to a y-value, so there's no point in including r = 0 in the data.

Bobby

On Mon, 8 Nov 2004 03:13:12 -0500 (EST), Feng-Yin Chang <fychang at slac.stanford.edu> wrote:

> Hi All,
>    Could anyone give me any suggestion for the specified  fitting function
>    f= r^a Exp[-b r]?
>    My data point was given below,
>    data={{0, 1.00002}, {2.31507, 26.4522}, {4.32033, 56.8265}, {6.63539,
>     59.6674}, {8.64066, 39.5536}, {10.9557, 21.6862}, {12.961,
>     10.1456}, {15.276, 4.39652}}
>
>   The following way,
>    NonlinearFit[data,f,r,{a,b}], gives the error message,
>    FindFit::njnum:
>    The Jacobian is not a matrix of numbers at (a,b)={1.,1.}.
>
>   How should I do this fitting without the problem?
>
>
> Feng-Yin Chang,
> Institute of Physics,NCTU,Taiwan
>
>
>
>



-- 
DrBob at bigfoot.com
www.eclecticdreams.net


  • Prev by Date: Re: Mathematica Categorization - Humor
  • Next by Date: Re: NonlinearFit problem
  • Previous by thread: NonlinearFit problem
  • Next by thread: Re: NonlinearFit problem