       Re: NonlinearFit problem

• To: mathgroup at smc.vnet.net
• Subject: [mg52074] Re: NonlinearFit problem
• From: Paul Abbott <paul at physics.uwa.edu.au>
• Date: Tue, 9 Nov 2004 01:37:48 -0500 (EST)
• Organization: The University of Western Australia
• References: <cmnabi\$7sn\$1@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```In article <cmnabi\$7sn\$1 at smc.vnet.net>,
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?

It is the first data point that is causing the problem. As the error
message says, the Jacobian

Outer[D, {r^a Exp[-b r]}, {a, b}]

is not a matrix of numbers at (a,b)={1.,1.}, unless you take the limit
as r->0.

If you drop the first point, or perturb the x value away from 0, the fit
proceeds without problem. For example,

data={{0.0001, 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}}

FindFit[data, r^a Exp[-b r], {a,b}, r]

Cheers,
Paul

--
Paul Abbott                                   Phone: +61 8 6488 2734
School of Physics, M013                         Fax: +61 8 6488 1014
The University of Western Australia      (CRICOS Provider No 00126G)
35 Stirling Highway
Crawley WA 6009                      mailto:paul at physics.uwa.edu.au
AUSTRALIA                            http://physics.uwa.edu.au/~paul

```

• Prev by Date: Re: NonlinearFit problem
• Next by Date: Re: Re: need help with integration
• Previous by thread: Re: NonlinearFit problem
• Next by thread: Re: Re: NonlinearFit problem