MathGroup Archive 1999

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: best line through a set of 3D points


at first make some data


and then fit the components of the vector to linear functions

pf=Fit[#,{1,t},t] & /@ Transpose[data]

Hope that helps

Maarten.vanderBurgt at wrote:
> Dear all,
> This is not strictly a mathematica question but someone might have a
> solution in the form of a mathematica function or so.
> I have a set of 3d points, DATA = {{x1,y1,z1},{x2,y2,z3},...}, roughly
> occupying a sigar shaped volume in the 3D space.
> I want to find the line that best fits these points.
> I tried a least squares approach: I assumed the line was going through the
> average off all the points in DATA and then I tried to find a vector in the
> direction of the line by minimizing the sum of the squares of the distances
> from the points to the line.
> For some reason I end up with a set of 3 equations which only solution is
> (0,0,0).  There is probably some sensible reason for this but I did not
> manage to figure out why. Maybe someone else knows?

> thanks a lot
> Maarten

  • Prev by Date: Re: Re: easiest way to sort a list?
  • Next by Date: Re: Split on the Macintosh
  • Previous by thread: Re: best line through a set of 3D points
  • Next by thread: Re: best line through a set of 3D points