Hi all, I have several variables
time x y31977674 200 19531978007 204 19831978341 200 19531978674 200 19531979008 200 19531979341 201 19631979674 201 19631980008 202 19631980341 202 19631980674 203 196......
Presume in this case x,y are positions of say a ball rolling around at a given time. I now have a set of new times without x,y co-ordinates, none of the times match times already existing, so I have gone through the time list and find the two closest to that value (either side.)
So for example: given 31977674 = (200,195) and 31978007 = (204,198) what position am I at with a time 3197900?
I guess I need to use some sort of interpolation function but I'm struggling to see how to apply it in this case. I looked up interp2 in the help:
Vq = interp2(X,Y,V,Xq,Yq) returns interpolated values of a function of two variables at specific query points using linear interpolation. The results always pass through the original sampling of the function. X and Y contain the coordinates of the sample points. V contains the corresponding function values at each sample point. Xq and Yq contain the coordinates of the query points.
But Xq and Yq are the 'co-ordinates of the query points' – I seem to want the opposite of this, I want the points given the time!
Apologies If I have misunderstood, the help is much appreciated.
Best Answer