LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Get waveform value at specific time

I have an analog waveform and I would like to find the Y value at a specific time, for example 0.2s. What I have right now is shown below (it will not be a square wave but this is just for practicing). I separate the analog waveform into two arrays, then check the time values for 0.2s, then use that index for the value array. First, there must be an easier way, and second, my time value may not always appear. I was thinking about interpolating, but it would only interpolate the x array and not the y array with it. The closest value to 0.2s is acceptable but I'm not sure how to add a tolerance or check the closest value.

 

 

simmertime_0-1660575622008.png

 

0 Kudos
Message 1 of 2
(553 Views)

Once you attach your VI we can give you a trivially simpler solution. You should never do equal comparisons with DBL (as e.g. implied by search array).

 

From dt (assuming t0=0), you can calculate from first principles what the closest index is, so just index that out from the Y array. Right?

 

altenbach_0-1660579115019.png

 

 

And if you actually want an interpolated Y value at the fractional index, use Interpolate 1D array.

 

altenbach_0-1660579382459.png

 

 

 

0 Kudos
Message 2 of 2
(542 Views)