LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to detect the instants of level changes in a waveform using Labview?

 

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.

IET-PEL.2019.0255.06.gif

0 Kudos
Message 1 of 5
(1,589 Views)

Hi Gnana,

 

compare the current sample with the previous sample. Whenever they aren't the same you have found the next step…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 5
(1,546 Views)

@GerdW The data is too noisy, the samples are not exactly same with in the same level. Any solution to that kind of data?

0 Kudos
Message 3 of 5
(1,535 Views)

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).


GCentral
0 Kudos
Message 4 of 5
(1,530 Views)

Here's a snippet that might be a possible solution (with some fiddling to values etc).

Example_VI.png


GCentral
0 Kudos
Message 5 of 5
(1,528 Views)