07-11-2006 09:03 AM
07-11-2006 09:41 AM
07-11-2006 11:16 AM
Thanks for the suggestion but I am afraid I was not clear.
I want to resample X and Y linearly using just neighborhood elements.
thus, given
X={0.5, 0.9, 1.2, 1.6} and corresponding Y={1,2,3,4},
I would like to resample X according to:
X2={0.5,1,1.5,2}
Y2 is the resampled values for the resampled abscissa X2
if i is the index for X2, j is the index of the closer X smaller than X2[i],
j+1 is the index of the closer X greater than X2[i]
Y2(i) = Y(j)+ X2(i)-X(j) * (Y(j+1)-Y(j))/(x(j+1)-X(j))
thanks for your help,
Michele
07-11-2006 02:51 PM - edited 07-11-2006 02:51 PM
Oho, I see.
Well, I'm afraid the only solution lies in the last equation you wrote: you'll need to apply it to every pair of elements of your arrays in a loop. But I would consider the polynomial interpolation: it can give you brilliant results with a few lines of code and can be easily tested. Supposing the results are not heavily dispersed the resulting intepolated values won't be so far from linear interpolation...
Message Edited by Roberto Bozzolo on 07-11-2006 09:51 PM
07-12-2006 04:32 AM
Thanks Roberto,
I am afraid I have to use the linear one anyhow..
regards,
Michele