MathGroup Archive 1999

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

Search the Archive

Re: best line through a set of 3D points

  • To: mathgroup at smc.vnet.net
  • Subject: [mg18387] Re: best line through a set of 3D points
  • From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
  • Date: Wed, 7 Jul 1999 00:10:55 -0400
  • Organization: Universitaet Leipzig
  • References: <7lcfio$1kv@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Hi, 

at first make some data

data=Table[{t+0.2*Random[],2t+0.3*Random[],t/2+0.1*Random[]},{t,1,10,0.1}];

and then fit the components of the vector to linear functions

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


Hope that helps
  Jens

Maarten.vanderBurgt at icos.be 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