← All exercises

Lag Filter

medium

Smooths a noisy analog input by closing a fraction of the gap to it once per second.

What it teaches

Each second, move the output a fixed fraction of the way toward the input — the classic first-order lag. A small fraction smooths heavily but responds slowly; a large one tracks fast but smooths less. Jitter averages away while sustained moves still arrive, just softened. Complements a median filter: the median rejects single bad samples outright, the lag softens everything.

Inputs and outputs

TagTypeDefaultDescription
In_ValueREAL100Noisy analog input
Cfg_TauDINT4Smoothing strength; each tick closes 1/Cfg_Tau of the gap
Out_FilteredREALSmoothed value

Required behavior