[Date Index]
[Thread Index]
[Author Index]
NonlinearModelFit Problem
*To*: mathgroup at smc.vnet.net
*Subject*: [mg129464] NonlinearModelFit Problem
*From*: JCW <Please.No.EMail at comcast.net>
*Date*: Wed, 16 Jan 2013 01:38:43 -0500 (EST)
*Delivered-to*: l-mathgroup@mail-archive0.wolfram.com
*Delivered-to*: l-mathgroup@wolfram.com
*Delivered-to*: mathgroup-newout@smc.vnet.net
*Delivered-to*: mathgroup-newsend@smc.vnet.net
I hope I'm doing something obviously stupid, but I can't figure it
out. I'm trying to fit a list of points [x, z, y] (in a cartesian
coordinate system) that very closely approximate a shallow sphereical
cap. The cap was generated by cutting an approximate sphere with a
plane approximately parallel to the x-z plane so that the cap is
apprximately symmetrical around the y-axis. Thus the cap can be
expressed conveniently as y[x,z], but only less accurately as y[r],
where r = Sqrt[x^2 + z^2], because the original sphere's center was
not exactly on the y-axis. I have very good guesses for the center
location and the radius of curvature; I want more accurate values for
these parameters from the fit.
The following expression incorporating all of the degrees of freedom
will not converge but wanders off toward very large values of all
parameters:
nlm = NonlinearModelFit[distortedNodeLocations,
-Sqrt[fitRadiusOfCurvature^2 - (x - fitxOffset)^2 -
(z - fitzOffset)^2] + fityOffset + radiusOfCurvature +
originalOffset, {{fitRadiusOfCurvature,
radiusOfCurvature}, {fitxOffset, 0.}, {fityOffset, 0.},
{fitzOffset, 0.}}, {x, z}, AccuracyGoal -> 8,
PrecisionGoal -> 12, MaxIterations -> 1000]
(originalOffset is just a constant that forces the spherical cap to
cut the y-axis where I wnat.) In trying to diagnose the problem, I
eventually converted the data l1st to the form, [r, y] (r as defined
above) and successfully fitted it with a simple two-parameter model
(neglecting fitxOffset and fitzOffset):
nlm = NonlinearModelFit[radialFitData,
-Sqrt[fitRadiusOfCurvature^2 - r^2] + fityOffset +
radiusOfCurvature + originalOffset,
{{fitRadiusOfCurvature, radiusOfCurvature},
{fityOffset, 0.}}, r, AccuracyGoal -> 15]
The above model converges very well, yields reasonable values for
fitRadiusOfCurvature and fityOffset, and gives a very low RMS
residual. BUT when I try to fit what should be an essentially
identical model to the original data list, the convergence fails as
describe above for the full model:
nlm = NonlinearModelFit[distortedNodeLocations,
-Sqrt[fitRadiusOfCurvature^2 - x^2 - z^2] + fityOffset +
radiusOfCurvature + originalOffset,
{{fitRadiusOfCurvature, radiusOfCurvature},
{fityOffset, 0.}}, {x, z}, AccuracyGoal -> 8,
PrecisionGoal -> 12, MaxIterations -> 1000]
Even more puzzling, if I constrain the two parameters closely to the
guesses in the above fit, the constrained RMS residual is very much
larger that that obtained when fitting the [r, y] data.
I haven't tried using FindFit yet, as the help files imply that it
uses the same fitting engine. Any suggestions would be greatly
appreciated. -- jclarkw
Prev by Date:
**Re: TraditionalForm Plot**
Next by Date:
**Re: Aligning graphics on frame boundaries**
Previous by thread:
**random walk**
Next by thread:
**Re: NonlinearModelFit Problem**
| |