comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » interpolate weirdness
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: interpolate weirdness [message #87661 is a reply to message #87660] Fri, 21 February 2014 05:59 Go to previous messageGo to previous message
Helder Marchetto is currently offline  Helder Marchetto
Messages: 520
Registered: November 2011
Senior Member
On Friday, February 21, 2014 1:33:45 PM UTC+1, Helder wrote:
> On Friday, February 21, 2014 1:00:36 PM UTC+1, CR wrote:
>
>> Hi Folks,
>
>>
>
>>
>
>>
>
>> I know that there is no 'correct' way for interpolation, but maybe a 'best' IDL way. The following example easily demonstrates what I mean:
>
>>
>
>>
>
>>
>
>> IDL> d=dist(20) & print,interpolate(d,[.5],[.5],/grid)
>
>>
>
>> 0.853553
>
>>
>
>>
>
>>
>
>> IDL> print,interpolate(d,[.5],[.5],/grid,/cubic)
>
>>
>
>> 0.622236
>
>>
>
>>
>
>>
>
>> IDL> print,interpolate(d,[.400544],[.400544],/grid)
>
>>
>
>> 0.707107
>
>>
>
>>
>
>>
>
>> IDL> print,interpolate(d,[.581946],[.581946],/grid,/cubic)
>
>>
>
>> 0.707107
>
>>
>
>>
>
>>
>
>> IDL> print,'The result should be: ',sqrt(.5)
>
>>
>
>> The result should be: 0.707107
>
>>
>
>>
>
>>
>
>>
>
>>
>
>> It does not play a role which IDL version is used - for IDL 6.4 and for IDL 8.3 I got the same results. Is there any way to get 'closer' to a reasonable result?
>
>>
>
>>
>
>>
>
>> Thanks and Cheers
>
>>
>
>>
>
>>
>
>> Chris
>
>
>
> I'm not sure what you're trying to do here, but interpolating near borders is kind of complicated because you can only have one side to rely on. However, if you're going to use bicubic interpolation, I would recommend using:
>
> print,interpolate(d,[.5],[.5],/grid,cubic=-0.5)
>
> then you get:
>
> 0.738791
>
> Hope it helps,
>
> h

Just for sake of comparison, if you do the same for a point not next to the boundary, you get:
print,interpolate(d,[5.5],[5.5],/grid, cubic=-0.5)
7.77795
print, sqrt(2)*5.5
7.77817
The difference is 0.00022220612, what is much better.

Hope it helps.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Behaviour of colorbar title in z-buffer?
Next Topic: Orientation of Contour Labels

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sun Oct 12 08:07:08 PDT 2025

Total time taken to generate the page: 2.47977 seconds