Re: Special Nonlinear Fitting

• To: mathgroup at smc.vnet.net
• Subject: [mg2395] Re: [mg2368] Special Nonlinear Fitting
• From: hwalker at UH.EDU (Hugh Walker)
• Date: Tue, 31 Oct 1995 23:24:33 -0500

```In [mg2368], Eric Lindahl (f91el at efd.lth.se)  writes:

<I need to do a nonlinear fitting of data to a function, where I can't get
an explicit expression for the functions value.Let me give you an
example:Assume I have the data point as pairs {x,y}. I want to "solve" the
following relationship for the parameters a and b:
Y^2/X*f[Y^2/(X*a)]=b*given function of X.
with f[z]=z/Sqrt[1+z^2]...
Is there any procedure capable of this? I must be able to enter an equation
as the model, and state that "Y" is the
data value at each point.>
=============================

This may be helpful.  Write your fitting function in the form y =
G(x,y,a,b).  I will assume G is listable, and also assume data =
{xList,yList) is available from experiment.  The following fragment of code
gets the job done:
....
g := G[x,y,a,b];
del = yList - g/.{x->xList, y->yList};
FindMinimum[( (del.del)/.{a->afit,b->bfit} )//Evaluate, {afit, atry},{bfit,btry}
....

This seems to work well on simple cases such I have tried such as y = x^a
Exp[-b y].  As proposed, the final step uses the Newton-Raphson method. If
G's Jacobian is cumbersome or impossible to compute, then go the secant
route by replacing the last live with
FindMinimum[(del2/.{a->afit,b->bfit})//Evaluate, {afit,
atry1,atry2},{bfit,btry1,btry2}

Hugh Walker
Physics
Univ of Houston

```

• Prev by Date: Re: There must be a better way!
• Next by Date: Re: printing cell markers under windows front end????
• Previous by thread: Re: There must be a better way!
• Next by thread: Re: Mac Mma and graphics conversion to Adobe Illustrator