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
Forward Euler: y[n] = y[n-1] + T · u[n-1]
Backward Euler: y[n] = y[n-1] + T · u[n]
Trapezoidal: y[n] = y[n-1] + T · (u[n] + u[n-1]) / 2
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
See Also
- Integrator: Continuous-time integrator
- DiscreteDerivative: Discrete-time derivative (inverse operation)