Re: Interpolation [message #84947 is a reply to message #84944] |
Wed, 19 June 2013 11:14  |
Russell Ryan
Messages: 122 Registered: May 2012
|
Senior Member |
|
|
Just building on what Craig said. You write: "... interpolate it where the velocity is zero...." Does that mean you're looking for the time where the velocity goes to zero? If so, then there's a few ways to skin this cat.
You will need to do what Craig said about the time.
You might need to do what Craig said about good/bad data.
But then you will want to use interpol, but turn it around. Something like:
t0 = interpol(t,velocity,0.0)
would interpolate the times at the point where velocity equals zero. Now the catch is many-folded...
(1) do you have multiple zeros in the v(t) function?
(2) is the data noisy (if so, then then you could have an issue of noise-spikes spoofing multiple zeros).
(3) there might be better ways at this (for example, this would tell you a crude estimate of the time. but you could "refine" that estimate by then fitting some smooth polynomial to the velocities around this time and then invert that polynomial. I'd wager that the points around the v(t)=0 point are somewhat parabolic, so maybe a 2nd order would be fine --- and it's easy to invert. But, w/o seeing the data there's no way to know).
(4) there are several optional inputs to interpol (lsquadratic, quadratic, spline), you'll have to guess which is right for you.
-Russell
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
>
>
>
> Read,datalines
>
> Fitacf=DBLARR(4,datalines)
>
> Hr=0.000
>
> Min=0.000
>
> Sec=0.000
>
> Vel=0.000
>
> OPENR,1,’filename’
>
> For i=0, (datalines-1) do begin
>
> Readf,1,hr,min,sec,b12
>
> Readf,1,vel
>
> Fitacf(0,i)=hr
>
> Fitacf(1,i)=min
>
> Fitacf(2,i)=sec
>
> Fitacf(3,i)=vel
>
> Endfor
>
> Close,1
>
>
>
> My progam is working but not interpolating.
>
> Thank you in advance for your time.
>
>
>
> Bongz
|
|
|