DiscreteIntegrator Block
Discrete-time integrator (accumulator). Supports forward Euler, backward Euler, and trapezoidal methods.
Open DiscreteIntegrator in BlockWerk →# DiscreteIntegrator Block
Description
Discrete-time integrator that accumulates the input signal over time. Equivalent to a running sum scaled by the sample time.
Mathematical Model
\begin{aligned} &\text{Forward Euler:} && y[n] = y[n-1] + T \cdot u[n-1] \\ &\text{Backward Euler:} && y[n] = y[n-1] + T \cdot u[n] \\ &\text{Trapezoidal:} && y[n] = y[n-1] + \frac{T}{2} (u[n] + u[n-1]) \end{aligned}
where y[n] is the current output, u[n] the current input, and T the sample time.
Parameters
method
Integration method:
- forward: Forward Euler — uses previous input value
- backward: Backward Euler — uses current input value
- trapezoidal: Trapezoidal rule — averages current and previous input
initialCondition
Starting value of the accumulator.
sampleTime
Discrete sample period (seconds).
Remarks
- Forward Euler: Simplest method but can be unstable for fast dynamics; suitable for mild integration
- Backward Euler: Implicit method — more stable for stiff systems; recommended for control loops
- Trapezoidal: Best accuracy for smooth signals; matches Tustin/bilinear transform for filter design
- Reset: The integrator can be reset by changing the
initialConditionparameter at runtime - Windup: In feedback control loops, the integrator may wind up if the output is saturated; use anti-windup strategies
Examples
- Zie de ingebouwde voorbeelden in de handleiding voor een demonstratie van dit blok.
See Also
- Integrator: Continuous-time integrator
- DiscreteDerivative: Discrete-time derivative (inverse operation)