[Date Index]
[Thread Index]
[Author Index]
# Re: NonLinearFit
*To*: mathgroup@smc.vnet.net
*Subject*: [mg10795] Re: NonLinearFit
*From*: Paul Abbott <paul@physics.uwa.edu.au>
*Date*: Thu, 5 Feb 1998 00:58:39 -0500
*Organization*: University of Western Australia
*References*: <6atagt$jlr$11@dragonfly.wolfram.com>
Phil Howe wrote:
> I'm having a problem working with NonLinearFit, and would like some
> advice. To demonstrate the problem, I'll use a very simple expression,
> y==a*x^c +b, where I have assigned a=3, b=7, and c=2.
>
> This generates a simple data set:
> data=Table[{x, 3*x^2+7 +5*Random[]},{x,0,4,.2}];
>
> Now I try to use NonLinearFit. If I specify the value of the exponent,
> "c", the routine seems to work. If I ask it to find a value of c, it
> chokes, even if I tell it the right answer:
>
> NonlinearFit[data,a*x^c+b,x, {{c,2},{b,7},{a,3}}];
>
> NonlinearFit::"badderiv": "The matrix of model derivatives (dimensions
> \!\({3, 21}\)) includes DirectedInfinity in at least one element. Try
> fitting without data points having indices in the list \!\({1}\)."
The problem is that NonlinearFit computes the model derivatives, i.e.,
In[1]:= D[a*x^c + b, c]
Out[1]=
c
a x Log[x]
and, since your data includes 0, when NonlinearFit evaluates this model
derivative at x->0
In[2]:= % /. x -> 0
Out[2]=
c
0 a (-*)
you get a DirectedInfinity. If you delete 0 from your data,
data=Table[{x, 3*x^2+7 +5*Random[]},{x,0.2,4,.2}];
everything works fine:
Cheers,
Paul
____________________________________________________________________
Paul Abbott Phone: +61-8-9380-2734
Department of Physics Fax: +61-8-9380-1014
The University of Western Australia Nedlands WA 6907
mailto:paul@physics.uwa.edu.au AUSTRALIA
http://www.pd.uwa.edu.au/~paul
God IS a weakly left-handed dice player
____________________________________________________________________
Prev by Date:
**Re: polynomial coefficients in descending powers**
Next by Date:
**Re: A delauney triangulation problem.**
Prev by thread:
**Re: NonlinearFit**
Next by thread:
**3D Graphics Spherical Coordinates**
| |