LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Waveform resample losing the last sample

When using the Waveform Resample vi, I see the last sample is dropped when the X time value is <= the calculated dt value (Even if it is close to the calculated dt value).  Is there any way to avoid this?  My time data does have some jitter in it, which is why I'm resampling in the first place.

 

I've attached an example showing the effect... Just run it a few times and you should see the last sample being dropped.

 

Thanks,

 

XL600

 

 

0 Kudos
Message 1 of 5
(2,275 Views)

Why not create a suitable linear t ramp, then interpolate into the array of points?

 

resampleWaveform.png

0 Kudos
Message 2 of 5
(2,248 Views)

Interesting...

 

I'm using the resample (coerce mode) since the incoming data is often missing samples or 'laggy'.  I'm using coerce mode since I don't really want to stray from the source data (Sometimes it's enumerated values, sometimes not).

 

As a workaround, I'm currently taking the last time (X) and adding 1/2dt to it before passing it into the resample vi.  That seems to enforce always including the last sample at the right calculated X value (Though I just use the resulting waveform output).  Seems like a band-aid though...

0 Kudos
Message 3 of 5
(2,244 Views)

@xl600 wrote:

Interesting...

 

I'm using the resample (coerce mode) since the incoming data is often missing samples or 'laggy'.  I'm using coerce mode since I don't really want to stray from the source data (Sometimes it's enumerated values, sometimes not).

 

As a workaround, I'm currently taking the last time (X) and adding 1/2dt to it before passing it into the resample vi.  That seems to enforce always including the last sample at the right calculated X value (Though I just use the resulting waveform output).  Seems like a band-aid though...


Another approach that could work is to reflect your data set about the last point and append that to the end of the array of samples. Then run that composite array through the re-sample and afterwards, toss the bogus data at the end.

 

It worked for an application that needed to filter a noisy data set and then figure out what the slope at the tail end of the data set was (needed to predict if we had to ship more stuff before they ran out). It also worked in this topic and also in another thread ( that I can not find right now) where Chiley Charlie was helping someone that wanted to monitor the burp rate of his fermenting beer to determine when it was ready.

 

The math may be wonky but it accomplishes what the human eye does when we anticipate what is going to happen based on a trend we are watching develop. "If it continues like it is now" we anticipate the trend continuing in the same manner. The reflection about the last data point use the same data set only reversed.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 4 of 5
(2,232 Views)

It sounds like this is a known issue with the resample VI?  My waveforms can reach quite large sizes so reflecting the whole thing probably wouldn't work well (Though I could reflect just a few samples then toss those out...).  The simplicity of just bumping the time of the last sample by half of a dt seems to work well though.

 

In all honesty, monitoring the burp rate for fermentation seems like a far more interesting pursuit than my data (Aircraft pilot control monitoring) Smiley Wink

 

Thanks for the suggestion!

 

 

0 Kudos
Message 5 of 5
(2,229 Views)