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

Home » Public Forums » archive » Re: correct way to use INTERPOLATE function
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: correct way to use INTERPOLATE function [message #55972 is a reply to message #55968] Fri, 21 September 2007 14:35 Go to previous messageGo to previous message
pgrigis is currently offline  pgrigis
Messages: 436
Registered: September 2007
Senior Member
R.G. Stockwell wrote:
> "Ryan." <rchughes@gmail.com> wrote in message
> news:1190408773.723336.302670@o80g2000hse.googlegroups.com.. .
>>> Is that waht you are trying to do?
>>
>> Thanks Paolo and David. That's not what I wanted to do but it did
>> help me out to produce the plot I want. I want to create a smallarray
>> vs. largearray plot but If I just tried to plot it, IDL will do what
>> it does best and plot only the first N_ELEMENTS(smallarray) points.
>> The code that I did come up with is as follows (It is very close to
>> what Paolo had):
>>
>> l = FINDGEN(100)*0.5
>> s = [10.3, 9.6, 9.2, 8.5, 7.7, 6.9, 5.8, 5.4, 4.7, 4.1]
>> ns = N_ELEMENTS(s)
>> nl = N_ELEMENTS(l)
>>
>> x = FINDGEN(ns)/(ns-1)
>> x2 = FINDGEN(nl)/nl
>>
>> z = INTERPOL(s, x, x2)
>>
>> PLOT, z, l, PSYM=-6
>
>
> Hi Ryan,
>
> I took a quick glance, and for the life of me i can't figure out
> what it is that you really want to do. You are plotting the
> "l" array here as a function of your "z" (which is
> based on your original "s"). I don't think that means
> anything.

Maybe I know what's happening here...

Let's assume you have a low-resolution circle
given by x1 and y1 coordinates:

n=10
t1=findgen(n)/(n-1)*!Pi*2
x1=sin(t1)
y1=cos(t1)

and a high resolution circle given by x2 and y2

n=64
t2=findgen(n)/(n-1)*!Pi*2
x2=sin(t2)
y2=cos(t2)

Then, assume that for some reason you have
access to x1 and to y2 and not to x2, and you
want to try to plot the best possible approximation
of the high-res circle. Then one may need to
do something like:

xx2=interpol(x1,t1,t2)

and plotting (xx2,y2) is an approximation
to the circle (of course, in such a case,
use of the /spline keyword to interpol may
make the plot nicer).

So, this may be something along the line
of what the OP is doing...

Ciao,
Paolo






>
> I assume you have a watered down example of your
> original problem, but it just seems like
> 1) you have it backwards (i.e. you want to plot
>> plot l,z
>
> and 2)
> you probably shouldn't be doing that in the first place.
>
> My point would be that the elements of "s" should have some
> ordinate related to them. Select the proper ordinate to pair with
> the "s"es and just plot that.
>
> Or if you need to interpolate, then interpolate both in the exact
> same way.
>
> Cheers,
> bob
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: News server
Next Topic: 'object' in IDL terminalogy

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

Current Time: Fri Oct 10 09:57:14 PDT 2025

Total time taken to generate the page: 0.16364 seconds