Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Topic: NonlinearModelFit Problem
Replies: 3   Last Post: Jan 18, 2013 12:50 AM

 Messages: [ Previous | Next ]
 Ray Koopman Posts: 3,383 Registered: 12/7/04
Re: NonlinearModelFit Problem
Posted: Jan 18, 2013 12:50 AM

On Jan 16, 8:15 pm, Frank K <fkam...@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}]

Date Subject Author
1/16/13 JCW
1/16/13 Frank K
1/18/13 JCW
1/18/13 Ray Koopman