Skip to content

Rate Limiter

Moves the output toward the input while limiting its per-second rising and falling rates.

With prev = ic at n = 0 and prev = y(n-1) afterward, y(n) = limit(u(n), prev + dt*falling_rate, prev + dt*rising_rate).

Direction Name Type
Input u T
Output y T
Name Type Default Meaning
T type (default f64) f64 Float scalar or float array type
rising_rate T 1.0 Maximum rise per second
falling_rate T -1.0 Maximum fall per second
ic T ZERO First output and starting state

T may be a float scalar or float array; limiting is element-wise for arrays. Use a positive rising rate and negative falling rate.

With dt = 0.1, ic = 0, rising_rate = 2, falling_rate = -1, and inputs 1, 1, -1, outputs are 0.2, 0.4, 0.3.