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 #55982 is a reply to message #55981] Fri, 21 September 2007 11:42 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Ryan. writes:

> I want to plot two arrays of different sizes so I am trying to use
> INTERPOLATE on the smaller array to make it the same size as the large
> one. I can't seem to use the INTERPOLATE function correctly and there
> isn't very much documentation on how to generalize it's use. I need
> help in generalizing its use. All I get as a result is the first
> element repeated (the same result I would get if I used the REPLICATE
> function). I want to do this in the general case because I need to do
> it a few times. Here is a simpler version of what I am doing:
>
> smallarray = [10.3, 9.6, 9.2, 8.5, 7.7, 6.9, 5.8, 5.4, 4.7, 4.1]
> largearray = FINDGEN(1000)*0.5
>
> smsize = N_ELEMENTS(smallarray)
> lasize = N_ELEMENTS(largearray)
>
> interpped = INTERPOLATE(smallarray, smsize/(lasize-1)*FINDGEN(lasize))
>
> PLOT, interpped, largearray
>
> One feature of the small array is that it is decreasing throughout and
> has approximately 100 elements. The large array has several thousand
> elements. I believe there is an error in the equation I have in the
> second argument.

It's not clear to me exactly what you are hoping to do,
but it seems clear INTERPOLATE isn't the way to do it. :-)

I think something like this will work:

PLOT, Congrid(smallarray, N_Elements(largearray)), largearray

This will not change the values in smallarray that get plotted.
If you want to interpolate the values, set the INTERP keyword
to CONGRID.

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
[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: Sat Nov 29 03:08:17 PST 2025

Total time taken to generate the page: 0.23791 seconds