06-15-2026 05:24 AM
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:
Automatically detect stable regions (plateaus)
Ignore transition areas
Compute average for each detected region
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!
06-15-2026 09:48 PM
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.
06-15-2026 10:04 PM
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.
06-15-2026 11:28 PM
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.
06-16-2026 10:20 AM
@syrpimp wrote:
If I had to look at your data, I would probably find different "constant" regions (yellow)
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?
06-16-2026 12:06 PM
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.
06-17-2026 04:20 AM
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 ..