Interpolation question [message #49587] |
Wed, 02 August 2006 09:21 |
Mike Wallace
Messages: 25 Registered: May 2006
|
Junior Member |
|
|
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]
Right now, I'm looping over the new_time array, finding the indexes
where the new_time value falls, and doing a simple weighted average. I
just have a gut feeling that there's a better way. TIA,
Mike
|
|
|