How do I find the peaks in a noisy signal automatically?

Add the filter function peaks(Threshold, bAbsolut, Type) to a copy of the curve and show the copy as markers. UniPlot keeps only the local maxima, the local minima or both, and ignores small wiggles below the threshold. The peaks appear as points on top of the original signal.

NOx signal of an engine test with the peaks marked as red dots

NOx emission during an engine test (blue) and the peaks found with peaks(40, 0, 1) (red).

How it works

  1. Copy the curve (Ctrl+C, Ctrl+V).

  2. Right-click the copy, choose Edit Filter Functions…, select peaks and click =>. Click Edit and set the parameters:

    • Threshold: how much a peak must stand out. Only extremes whose difference to the neighboring extreme is larger than the threshold are kept.

    • bAbsolut: 0 = threshold in percent of the y range, 1 = threshold in the units of the signal.

    • Type: 1 = maxima (peaks), 2 = minima (valleys), 3 = both.

  3. Click OK.

  4. In Data=>1D- and 2D-Dataset…, switch the line off, switch markers on and set Plot Symbols for to the filtered data.

In a script:

XYSetFilterFunctions(hData, "peaks(40, 0, 1)");

Why it helps

  • No scrolling through long recordings to find maximum values by eye.

  • The threshold adapts to the signal: a value in percent works for files with different levels.

  • The peaks are a normal dataset: show them as a table, count them or compare them between test runs.

Good to know