PE2-3.5 Event Detection & Waveform Analysis

Standard biomedical instrumentation and signal processing theory — written September 2026

What this is and why it exists

A clean recording is not yet an answer. Something has to find the events in it and measure them, and do so automatically over hours of data.

One algorithm dominates this topic and has done for decades. It is worth working through stage by stage, because it is a masterclass in stacking simple operations to solve a hard problem.

The vocabulary

  • QRS complex — the sharp group in the heart's waveform corresponding to the ventricles.
  • R peak — the tallest point of that group, used as the beat's time marker.
  • Bandpass stage — a filter passing the band the wanted feature occupies.
  • Squaring — making every sample positive and emphasising large values.
  • Moving window integration — smoothing the squared signal into a single broad hump per beat.
  • Adaptive threshold — a decision level that follows the recent signal and noise levels.
  • Dicrotic notch — a feature in the arterial pressure waveform marking a valve closing.
  • Template matching — comparing a beat's shape against a stored example.
  • Envelope — the outline of a signal that varies in amplitude.
  • Periodogram — an estimate of a signal's frequency content from one stretch of data.

The mental model

Start with what is being looked for. The heart's waveform has named parts, and the sharp central group is both the largest and the steepest. That steepness is the property every detector exploits.

A derivative-based detector does exactly that. Differentiate, and the steep part produces a large output while slower features produce little. It works, and it is fragile, because noise is also steep. A single spike of interference looks exactly like the feature being sought.

The standard algorithm answers that fragility by stacking simple stages, each one removing a different failure.

First a bandpass filter, keeping the band the sharp group occupies and rejecting baseline wander below it and muscle noise above. Then a derivative, which emphasises steepness as before, but now on a signal from which much of the noise has already gone. Then squaring, which makes everything positive and emphasises large values over small ones, so the wanted feature stands further above the rest. Then integration over a moving window about as wide as the feature. That turns a spiky trace into one broad hump per beat. A single hump is far more reliable to detect than a cluster of spikes.

Finally an adaptive threshold. Rather than a fixed level, the decision level follows the recent signal and noise estimates and updates as they change. That is what makes the algorithm survive a recording whose amplitude drifts, which is every real recording. It also holds a refractory period, refusing a second detection too soon after the last, because the heart physically cannot beat that fast.

No single stage is clever. The result works because each stage removes a specific way the previous approach failed, and that is the transferable lesson.

Once the beats are marked, everything clinical follows. The interval between beats gives the rate. The variation in that interval carries information of its own. Beats arriving early, late or in the wrong shape can be flagged.

The dicrotic notch is a good second exercise in the same ideas, applied to the pressure waveform rather than the electrical one.

Shape analysis is the next step. Store a template of a normal beat for that patient and compare each new beat against it using a correlation coefficient. A high value means the same shape, and a low one flags a beat worth examining. The limitation is worth knowing. The correlation coefficient ignores scale, so a beat of the right shape and the wrong size scores well. When beats have different lengths, comparing them fairly needs care, which is what the more technical items in this topic address.

Envelope extraction handles signals whose information is in how their amplitude varies rather than in their detailed shape. Heart sounds are the example. Extract the outline and a complicated waveform becomes something interpretable.

Muscle signals get four cheap measures instead. The root mean square value says how much energy is present. The zero crossing rate says roughly how fast the signal is. The turns count says how many direction changes there are. The form factor combines measures into a shape descriptor. None is sophisticated, all are cheap to compute, and they carry real diagnostic information, which is why they have survived.

The topic closes on a genuinely surprising fact. Estimating a spectrum from one stretch of data gives an estimate whose variance does not fall as you collect more data. A longer record gives more frequency points, and each is as uncertain as before. The fix is to cut the record into segments, compute an estimate from each, and average them. You trade frequency resolution for a reduction in variance, and that trade has to be made deliberately.

What you should now be able to explain or do

Say what property of the waveform every detector exploits and why a plain derivative is fragile. Name the stages of the standard algorithm in order and say what each one removes. Explain what an adaptive threshold and a refractory period each protect against. Use template matching with a correlation coefficient and state its limitation. Name the four activity measures, and say why averaging is needed for a spectral estimate.

Check yourself

The steepness of the sharp central group. It changes faster than anything else in the waveform.

Noise is also steep. A single spike of interference produces the same large derivative as the feature being sought.

It turns a spiky trace into one broad hump per beat. A single hump is much easier to detect reliably than a cluster of spikes.

A recording whose amplitude drifts. A fixed level would miss beats when the signal falls and produce false ones when it rises.

The variance of a single estimate does not fall with more data. Averaging segments reduces it, at the cost of frequency resolution.

Go deeper

We haven't checked most of these for screen reader use yet.

Back to Event Detection & Waveform Analysis: work through the checklist