Signal Conditioning

cancel
Showing results for 
Search instead for 
Did you mean: 

How to calculate average of stable waveform regions (plateau detection) in LabVIEW?

syrpimp_0-1781518734137.png

Hello Everyone 

I’m working on a waveform analysis application in LabVIEW and need help calculating the average value only within selected stable regions of the waveform.

My waveform contains transitions and flat sections (plateaus), and I only want to compute the average inside those plateau regions (similar to highlighted red boxes in the image).

Current approach:

  • Extract waveform using Get Waveform Components

  • Use Y Array

  • Select region using Array Subset

  • Compute average using Mean.vi

This works if the region indices are known.

What I’m trying to achieve:

  1. Automatically detect stable regions (plateaus)

  2. Ignore transition areas

  3. Compute average for each detected region

  4. Output an array of averages

My initial idea:

  • Difference between adjacent samples (ΔY)

  • Absolute value

  • Compare to threshold (|ΔY| < threshold)

  • Identify continuous stable segments

  • Apply Mean.vi

Questions:

  • Is there a better NI-native approach for this?

  • Would you recommend Peak Detector, Threshold Detector, PtByPt functions, or another signal processing VI?

  • Is there an existing example VI for plateau detection / averaging?

I attached a sample waveform and a raw data for reference.

Any suggestions or example block diagrams would be appreciated.

Thank you!



Thank you & Best regards
syrpimp

=======================================================
“You must continue to gain expertise, but avoid thinking like an expert." -Denis Waitley
0 Kudos
Message 1 of 7
(1,514 Views)

Is the shape of the waveform or the overall duration of the capture consistent and constant?

As much variability as can be converted to constants, your problem simplifies itself.

 

Try histogram method as well.

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution
0 Kudos
Message 2 of 7
(1,475 Views)

Hello Santo_13

No, neither the waveform shape nor the overall duration is constant. Both vary depending on the sensor output and the measured conditions. 



Thank you & Best regards
syrpimp

=======================================================
“You must continue to gain expertise, but avoid thinking like an expert." -Denis Waitley
0 Kudos
Message 3 of 7
(1,465 Views)

If you were to teach a human, how would you describe this task? (this is important to translate it to a logic)

I am curious why you didn't highlight the center segment or the end-segment, to me, those are also plateau.

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution
Message 4 of 7
(1,457 Views)

@syrpimp wrote:

syrpimp_0-1781518734137.png


If I had to look at your data, I would probably find different "constant" regions (yellow)

 

altenbach_0-1781622814464.png

 

I think once you better define what "constant" means, things will fall into place. Can you attach a simple Vi containing typical data.

 

You could try a pybypt linear fit with a suitable window and find sections where the slope is near zero and the standard deviation is below a certain threshold? How about applying a filter and take the first derivative?

 

Message 5 of 7
(1,428 Views)

altenbach beat me to it.. 

I'd also suggest putting the whole thing in a loop so you can 'get a feel for it'.  Without a mathematical definition, plateau is pretty subjective, so you'll end up playing with constants until the results start to look like what you want them to.  My filter is probably a bad fit, but you'll have to play with it.

 

wldgoose_0-1781629532640.png

wldgoose_1-1781629539016.png

 

 

Message 6 of 7
(1,417 Views)

The provided raw data show that there are plateaus with exactly the same value!

Is this an artifact of your data aquisition?  Seems that some of your input data used for the raw data has some quantisation steps .. 

 

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


0 Kudos
Message 7 of 7
(1,400 Views)