Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: nearestNeighbor
Replies: 4   Last Post: Jul 20, 2011 4:46 PM

 Messages: [ Previous | Next ]
 Michel Slivitzky Posts: 69 Registered: 12/7/04
Re: nearestNeighbor
Posted: Jul 20, 2011 1:19 PM

Thanks for the information
Yes , I am using DelaunayTri
If I look at the 3 index values returned from DT(SI,:) by pointLocation
- one of them is exactly the same as the index returned from nearestNeighbor
- but how do I know which one is the nearest ?

"Steven_Lord" <slord@mathworks.com> wrote in message <j06kd6\$f6k\$1@newscl01ah.mathworks.com>...
>
>
> "Michel " <slivitz@cite.net> wrote in message
> news:j06i7h\$8h9\$1@newscl01ah.mathworks.com...

> > I am trying to figure out what happens when a query points falls outside
> > the domain defined by dt.
> >
> > I am trying to look at the code using edit but iut only returns the help.
> >
> > nearestNeighbor returns the index of the nearest point in DT.X for each
> > query point location in QX (even if outside the domain) . The
> > corresponding Euclidean distances between the query points and their
> > nearest neighbors returned in D are excedingly high.

>
> So I assume you're using DelaunayTri?
>
> http://www.mathworks.com/help/techdoc/ref/delaunaytriclass.html
>

> > Is there a way to figure if the query point is "in" the domain ?
>
> Use pointLocation on your DelaunayTri.
>
> http://www.mathworks.com/help/techdoc/ref/delaunaytri.pointlocation.html
>
> If it returns NaN, your point is outside the convex hull of your data.
>
> --
> Steve Lord
> slord@mathworks.com