best fit 3D vector to points with a miss-distance specified
- To: mathgroup at smc.vnet.net
- Subject: [mg23122] best fit 3D vector to points with a miss-distance specified
- From: Wagner Truppel <wtruppel at ics.uci.edu>
- Date: Wed, 19 Apr 2000 02:30:51 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
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 > >FindMinimum[ > 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 ics.uci.edu