Interpolate [message #91906] |
Tue, 15 September 2015 02:16  |
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   |
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   |
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 #91915 is a reply to message #91914] |
Tue, 15 September 2015 07:37   |
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  |
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?
|
|
|