Re: Interpolation [message #84946 is a reply to message #84944] |
Wed, 19 June 2013 09:41   |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
On Wednesday, June 19, 2013 11:01:51 AM UTC-4, bong...@gmail.com wrote:
> Hi all,
>
> I have a problem here. I have a 4 column data:hr min sec velocity
>
> The sampling rate of the data is 3 sec. I need to interpolate it where the velocity is zero. The data is over a 10 hr period. Any suggestions please, I'm new in programming.
>
> The program looks like this
...
>
> My progam is working but not interpolating.
Well, there's no instructions in the code to do any interpolation, so that's not a big surprise.
Your first problem is that your time is in hours minutes and seconds. Usually you need a smoothly varying single time variable for interpolation. The expression,
T = (HR*60 + MIN)*60 + SEC
the new variable T is the number of seconds since the start of the day or your your experiment.
I would check for missing velocity values by using
WHMISSING = WHERE(VEL EQ 0, NMISSING)
The complement of that is all the good velocity values,
WHGOOD = WHERE(VEL NE 0, NGOOD)
To actually do interpolation you need to decide what kind of interpolation algorithm you want. Just for brevity's sake you can use INTERPOL()
VEL[WHMISSING] = INTERPOL( VEL[WHGOOD], T[WHGOOD], T[WHBAD] )
This says: given a grid of good points T[WHGOOD], VEL[WHGOOD], please provide interpolants at the times of my bad points T[WHBAD].
There are lots of other interpolation routines to check out. Also I'm skipping some of the error checking you should normally do. (for example, what happens if there are no bad points? no good points?)
Craig
|
|
|