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

Home » Public Forums » archive » Interpolation question
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: Interpolation question [message #49585 is a reply to message #25895] Wed, 02 August 2006 09:37 Go to previous message
mchinand is currently offline  mchinand
Messages: 66
Registered: September 1996
Member
In article <12d1k3ah497rj6c@corp.supernews.com>,
Mike Wallace <mwallace.no.spam.please@swri.edu.invalid> wrote:
> I have an array that I need to interpolate and would like to find a
> semi-efficient way to do it. Well, almost anything would be more
> efficient than what I'm currently doing.
>
> I have an array of data and a corresponding array of times when the data
> was taken. I have a third array that represents the times that I want
> to calculate the interpolation. How can I easily (and efficiently)
> calculate the data points corresponding to that array?
>
>
> For example...
>
> data = [12, 6, 1, 4, 8, 8, 10]
> time = [ 0, 1, 4, 7, 8, 11, 14]
>
> Now, I say that I wanted to interpolate the data array but only
> calculate the interpolation for the time values in some new array...
>
> new_time = [1, 4, 5, 8, 9, 12]
>

Check out INTERPOL:

IDL> new_data=interpol(data,time,new_time)
IDL> print, new_data
6.00000 1.00000 2.00000 8.00000 8.00000 8.66667

I changed the data array to float, otherwise the resulting new_data array is Integer type which you
may or may not want. INTERPOL has different interpolation types to choose from, linear, quadratic,
or spline.

Hope that helps,

--Mike

--
Michael Chinander
m-chinander@uchicago.edu
Department of Radiology
University of Chicago
[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
Read Message
Read Message
Previous Topic: Re: Length of command line input
Next Topic: ellipsoid 3D

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

Current Time: Fri Oct 10 20:25:00 PDT 2025

Total time taken to generate the page: 0.15097 seconds