Re: interpolation question [message #48393 is a reply to message #25895] |
Thu, 20 April 2006 07:50   |
chen123.dian
Messages: 4 Registered: April 2006
|
Junior Member |
|
|
Thanks, Peter,
Your code works well for 1-D data. It will be nice to extend it to 2-D
data.
Regards,
Chen
Peter Albert wrote:
> Hi Chen,
>
> I haven't tested this extensively, but I would try
>
> nn = y[round(interpol(indgen(n_elements(x)),x, u))]
>
> where "x" and "y" are the, well, x and y values and "u" is the vector
> with x-values for which the nearest neighbours are to be found.
>
> What goes on?
>
> The interpol command interpolates the indices of the x and y vectors to
> the new locations, round actually finds the nearest neighbour in terms
> of index, and then we just assign y with those indices.
>
> Regards,
>
> Peter
|
|
|