Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * @brief Applies a Low-Pass Filter to the input samples, adding inertia to the system.
- * @param y [in] previous/initial result of the function
- * [out] new result
- * @param x new sample value
- * @oaram dt time between the previous and the new sample
- * @param rc time constant - the reference measurement time.
- * The higher rc, the more inertia (less impact of a single x on y)
- */
- static function lpf(out float y, float x, float dt, float rc)
- {
- local float a;
- a = dt / (rc + dt);
- y = a * x + (1 - a) * y;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement