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

Home » Public Forums » archive » Interpolate
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Interpolate [message #91906] Tue, 15 September 2015 02:16 Go to next message
Dete van Eeden is currently offline  Dete van Eeden
Messages: 32
Registered: July 2015
Member
Hallo

If I have a set of data:

x= 0,1,2,3,4,5 and y = 101,245,366,410,525

how do I use the interpolate function to interpolate the y values for x= 0.5,1.5,2.5 etc?

Thanks!
Re: Interpolate [message #91907 is a reply to message #91906] Tue, 15 September 2015 04:20 Go to previous messageGo to next message
Haje Korth is currently offline  Haje Korth
Messages: 651
Registered: May 1997
Senior Member
On Tuesday, September 15, 2015 at 5:16:04 AM UTC-4, Dete van Eeden wrote:
> Hallo
>
> If I have a set of data:
>
> x= 0,1,2,3,4,5 and y = 101,245,366,410,525
>
> how do I use the interpolate function to interpolate the y values for x= 0.5,1.5,2.5 etc?
>
> Thanks!

use interpol instead of interpolate for this. ?interpol gives you the syntax.
Re: Interpolate [message #91913 is a reply to message #91907] Tue, 15 September 2015 06:31 Go to previous messageGo to next message
Dete van Eeden is currently offline  Dete van Eeden
Messages: 32
Registered: July 2015
Member
On Tuesday, September 15, 2015 at 1:20:32 PM UTC+2, Haje Korth wrote:
> On Tuesday, September 15, 2015 at 5:16:04 AM UTC-4, Dete van Eeden wrote:
>> Hallo
>>
>> If I have a set of data:
>>
>> x= 0,1,2,3,4,5 and y = 101,245,366,410,525
>>
>> how do I use the interpolate function to interpolate the y values for x= 0.5,1.5,2.5 etc?
>>
>> Thanks!
>
> use interpol instead of interpolate for this. ?interpol gives you the syntax.

Thank you, is there some way that you can just specify the amount of points for example if i want to interpolate 42 points to 256 points?
Re: Interpolate [message #91914 is a reply to message #91913] Tue, 15 September 2015 07:18 Go to previous messageGo to next message
Klemen is currently offline  Klemen
Messages: 80
Registered: July 2009
Member
IDL> x = findgen(42)
IDL> y = (x-20.)^2 ;just an example
IDL> plot, x, y
IDL> yy = interpol(y, 256)
IDL> plot, indgen(256), yy
Re: Interpolate [message #91915 is a reply to message #91914] Tue, 15 September 2015 07:37 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Klemen writes:

> IDL> x = findgen(42)
> IDL> y = (x-20.)^2 ;just an example
> IDL> plot, x, y
> IDL> yy = interpol(y, 256)
> IDL> plot, indgen(256), yy

Humm. Not sure that is right. Isn't it more like this:

x = findgen(42)
y = (x-20.)^2 ;just an example
!P.Multi=[0,2,1]
cgplot, x, y
xfrac = cgScaleVector(findgen(256), 0, N_Elements(x)-1)
yy = Interpolate(y, xfrac)
cgplot, xfrac, yy, color='red'
!P.Multi=0
END


Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: Interpolate [message #91919 is a reply to message #91913] Tue, 15 September 2015 10:32 Go to previous message
Haje Korth is currently offline  Haje Korth
Messages: 651
Registered: May 1997
Senior Member
Try i=interpol([101,245,366,410,525],[0,1,2,3,4,5],[0.5,1.5,2.5] )

On Tuesday, September 15, 2015 at 9:31:48 AM UTC-4, Dete van Eeden wrote:
> On Tuesday, September 15, 2015 at 1:20:32 PM UTC+2, Haje Korth wrote:
>> On Tuesday, September 15, 2015 at 5:16:04 AM UTC-4, Dete van Eeden wrote:
>>> Hallo
>>>
>>> If I have a set of data:
>>>
>>> x= 0,1,2,3,4,5 and y = 101,245,366,410,525
>>>
>>> how do I use the interpolate function to interpolate the y values for x= 0.5,1.5,2.5 etc?
>>>
>>> Thanks!
>>
>> use interpol instead of interpolate for this. ?interpol gives you the syntax.
>
> Thank you, is there some way that you can just specify the amount of points for example if i want to interpolate 42 points to 256 points?
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: medical image reconstruction
Next Topic: NetCDF: Converting time variable using start time from "units"

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

Current Time: Wed Oct 08 07:14:26 PDT 2025

Total time taken to generate the page: 0.00505 seconds