Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
NCTM or The Math Forum.



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 closedform 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}]



