3#include <janus/janus.hpp>
36template <
typename Scalar>
38 double a = std::exp(-dt / tau);
39 double b = K * (1.0 - a);
41 static_cast<Scalar
>(b), tau, K, dt};
55template <
typename Scalar>
57 const Scalar &state,
const Scalar &input) {
58 return coeffs.
a * state + coeffs.
b * input;
72template <
typename Scalar>
74 return static_cast<Scalar
>(K) * (1.0 - janus::exp(-t / tau));
Transfer function utilities for linear systems and nonlinear elements.
Definition Discretize.hpp:5
FirstOrderCoeffs< Scalar > first_order(double tau, double K, double dt)
Compute first-order discrete-time system coefficients.
Definition FirstOrder.hpp:37
Scalar first_order_response(double tau, double K, const Scalar &t)
Compute analytical step response at time t.
Definition FirstOrder.hpp:73
Scalar first_order_step(const FirstOrderCoeffs< Scalar > &coeffs, const Scalar &state, const Scalar &input)
Compute next state for first-order system (stateless).
Definition FirstOrder.hpp:56
First-order discrete-time system coefficients.
Definition FirstOrder.hpp:19
Scalar a
State coefficient: exp(-dt/τ).
Definition FirstOrder.hpp:20
double tau
Time constant [s].
Definition FirstOrder.hpp:22
double K
DC gain.
Definition FirstOrder.hpp:23
double dt
Sample time [s].
Definition FirstOrder.hpp:24
Scalar b
Input coefficient: K*(1 - a).
Definition FirstOrder.hpp:21