LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Obtaining the intersecting set of waveforms and resampling to match

I'm looking to take the intersecting set (time wise) of a number of overlapping waveforms and trimming all the waveforms to just that set. This is problem number one.
 
Problem number 2 is then resampling all of those waveforms to match the t0 timestamps and delta-t of the waveform with the highest sampling frequency.
 
The idea here is that I have a bunch of waveforms with non-identical start times and sampling parameters that I then have to process in a waveform X vs. waveform Y manner. So I have to get the intersecting set of the waveforms and match the sampling parameters.
 
Does anyone have any ideas on how to pull this off? My attempts so far have resulted in getting lost in the waveform manipulation VIs.
 
Thanks
0 Kudos
Message 1 of 4
(2,800 Views)
Let's clarify what you mean by "intersecting set": Do you mean they start at different times?  Do you mean they are different lengths?  Both?

As far as resampling - your best option might be to take the waveform with the lowest sample rate, perform an FFT on it, pad the center with (complex) zeroes, then do an inverse FFT.   That effectively resamples the waveform at a higher rate.  You'll have to know the laws about sampling: 
   Resolution = # Samples / Sample Rate.
So if you re-arrange that, you have SampleRate = # Samples / Resolution. Since the FFT has fixed the resolution for you, you can only adjust the #samples.  If you add zeroes to the center of the spectrum, you are increasing the #samples, and thus the sample rate.
Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 2 of 4
(2,796 Views)
Thanks for the tip about the FFT, I will give that a shot.
 
As far as the intersecting set goes. Ideally, I need a method that will literally take the intresection of all the waveforms and trim them to just the portions that overlap. In my specific case, one waveform starts later than the others and ends later too (longer duration). Strictly speaking, it would be nice to have a routine that trims an arbitrary number of waveforms, of arbitrary start time and duration, to just the portions that overlap. (the idea here is that I have some waveforms acquired by a DAQ card and others that are from a different source, with no way to synchronize the start of acquisition).
 
To give an example of the intersection, consider waveforms A,B and C, with start times and durations as given in the following bit of ASCII art:
 
A:    123456789012345
B:       1234567890123456789
C:      123456789
 
Resulting in:
 
A'       45678901
B'       12345678
C'       23456789
 
If there is no intersection, the routine would return an empty set. In my case, the sampling start times and sampling ratees would also have to be adjusted afterwards.
 
Thanks
0 Kudos
Message 3 of 4
(2,778 Views)
Looks to me like you've drawn the answer to your own question.

Your overall start time is the LATEST of the three start times.
Calculate a PAD factor for each signal - the number of samples you would have to add at the beginning to align it. In your example, the A pad factor would be 0, the B pad factor would be 3, the C pad factor would be 2.
Find the LONGEST of those pad factors ( 3 ), and call it your ALIGN point. Then your end time is going to be the SHORTEST of { A #samples + A Pad, B #samples + B Pad, C #samples + C Pad}.

In your example, that's the SHORTEST of {15+0, 19+3, 9+2 } or END TIME = 11.

Your START sample number for A is (Align point - A pad) 3 - 0 = 3

Your START sample number for B is (Align point - B pad) 3 - 3 = 0

Your START sample number for C is (Align point - C pad) 3 - 2 = 1

Your duration for all of them is (End Time - Start Point) 11 - 3 = 8

If the duration comes out to zero or less, there is no intersection.

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

Message 4 of 4
(2,770 Views)