01-14-2021 10:48 AM - edited 01-14-2021 11:05 AM
Can anyone guide me on how to detect the time instants(alpha1,alpha2,alpha3) from below waveform data using labview ?
I am able to detect level change instants in pulse train by setting a threshold using "find transitions" and "threshold detector" VIs but can't do it in stepped waveform like below because I can't choose a single threshold to detect all level changes.
01-14-2021 01:55 PM
01-15-2021 01:20 AM - edited 01-15-2021 01:21 AM
@GerdW The data is too noisy, the samples are not exactly same with in the same level. Any solution to that kind of data?
01-15-2021 02:25 AM
Do you know the expected levels? If so, identify which level each sample is, and do as GerdW suggested but with what is effectively a binning process.
If you don't know the levels (and they are arbitrarily spaced) then you need to decide a band of values that should be considered "the same" as each other.
You could then either
a) do the first approach, and construct bins for values, or
b) check if x_n - x_(n-1) < band, then consider same, else, consider different, or
c) for a probably improved version, try something like:
double sum = 0, average = 0, diff = 0;
int count = 0;
double band = some_constant_value;
first call:
sum = sum + new_sample;
count = count + 1;
average = sum/count;
then:
diff = new_sample - average;
if (diff > band) {
go back to start, reinitialize sum, count, average etc with new_sample
consider this a new group
} else {
sum = sum + new_sample;
count = count + 1;
average = sum/count;
}
Depending on the expected size of your groups, you might consider storing them all in an array that you're expanding, and then use the Mean.vi to get the average value, and Empty Array to find out if it is the first sample. This will be a bad choice if the group size becomes large (Build Array in loop with many iterations not ideal, and memory usage becomes high).
There's also a Mean Pt-by-Pt VI that could perhaps help in removing some of the busy-work for averaging (but you probably want to consider the difference before you take the average, it's simpler to do it the other way, but if you add the sample before calculating the diff, it will be swayed towards the "new" level always, which might be significant for small group sizes).
01-15-2021 02:35 AM