MathGroup Archive 2000

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

Search the Archive

best fit 3D vector to points with a miss-distance specified

  • To: mathgroup at
  • Subject: [mg23122] best fit 3D vector to points with a miss-distance specified
  • From: Wagner Truppel <wtruppel at>
  • Date: Wed, 19 Apr 2000 02:30:51 -0400 (EDT)
  • Sender: owner-wri-mathgroup at

At 1:01 AM -0500 on 3/31/00, Daniel Lichtblau wrote:

>Jim Fanning wrote:
>>  I would like to use Mathematica to solve for a vector in three dimensions
>>  that best fits a set of data points where the points are given by {x,y,z,r}.
>>  Where "x,y,z" is the data point location and "r" is the miss-distance from
>>  the data point to the vector.  Any suggestions would be greatly appreciated.
>>  Thanks, Jim
>Call the data points {x[1],y[1],z[1],r[1]}, ...{x[n],y[n],z[n],r[n]}.
>Then you might try something like
>   Sum[((x0-x[j])^2+(y0-y[j])^2+(z0-z[j])^2-r[j]^2)^2, {j,i,n}],
>   {x0,0}, {y0,0}, {z0,0}]
>This tries to minimize total sum of squares of differences between
>actual distances and desired distances. Different formulations of your
>objective function could be used to minimize different error norms.
>Daniel Lichtblau
>Wolfram Research

Dear Daniel,

that approach looks fine, but how can Jim be sure he's found the 
global minimum? For all we know, Mathematica may have 
gradient-descended to a local one. It seems to me that the way to 
alleviate the all-too-common problem of avoiding local extrema, in 
this example, would be to try your suggestion a large number of 
times, each with a randomly generated triplet of starting values for 
{x0, y0, z0}, and record the resulting triplet whenever a lower 
minimum is found.

Wagner Truppel
wtruppel at

  • Prev by Date: Matrix Differentiation in Mathematica
  • Next by Date: Vector Union
  • Previous by thread: Re: Matrix Differentiation in Mathematica
  • Next by thread: Kernel keeps crashing