Re: NonlinearModelFit Problem

• To: mathgroup at smc.vnet.net
• Subject: [mg129497] Re: NonlinearModelFit Problem
• From: Ray Koopman <koopman at sfu.ca>
• Date: Fri, 18 Jan 2013 00:52:13 -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
• References: <kd5htd\$jja\$1@smc.vnet.net> <kd7tt0\$q48\$1@smc.vnet.net>

```On Jan 16, 8:15 pm, Frank K <fkam... at gmail.com> wrote:
> I suggest you use FindMinimum and minimize the sum of the
> square of the distances of your points from the spherical
> cap as a function of the parameters describing the cap.

That will give the centroid of the data, which could be quite far
from the center of the sphere. I would try something like this.

The initial guess is a closed-form solution for the center that
minimizes the variance of the squared distances of the points from
the center. Then FindMinimum minimizes the variance of the distances
of the points from the center.

data = {{x1,y1,z1},...,{xn,yn,zn}}; m = Mean@data
guess = m + .5 Total[#^2].PseudoInverse[#]&[Transpose@data - m]
Clear[x,y,z]; FindMinimum[
Variance[Norm[#-{x,y,z}]&/@data], Transpose@{{x,y,z},guess}]

```

• Prev by Date: Re: NonlinearModelFit Problem
• Next by Date: Re: TraditionalForm Plot
• Previous by thread: Re: NonlinearModelFit Problem
• Next by thread: RegularExpression::maxrec: Recursion limit exceeded; positive match