Derivative Block
Computes the numerical time derivative (rate of change) of the input signal
Open Derivative in BlockWerk →Description
The Derivative block computes the numerical time derivative (rate of change) of an input signal using backward difference approximation. An optional low-pass filter parameter can be used to reduce noise amplification.
Mathematical Model
Pure derivative (filterCoefficient = 0, default)
dy/dt ≈ (u_n - u_{n-1}) / Δt
Filtered derivative (filterCoefficient = N > 0)
Transfer function: H(s) = N*s / (s + N)
Discrete: D[k] = (N * (u[k] - u[k-1]) + D[k-1]) / (1 + N * Δt)
where:
- u_n is the current input
- u_{n-1} is the previous input
- Δt is the sample time
- N is the filter coefficient (higher = less filtering)
Parameters
filterCoefficient
Low-pass filter coefficient for the derivative. Set to 0 (default) for pure differentiation.
- N = 0: Pure backward difference (no filtering)
- N = 10–100: Moderate to light filtering
- Higher N: Less filtering, faster response but more noise
- Default: 0
First-Step Behavior
On the very first simulation step, the output is always 0. This prevents a potentially infinite or very large spike that would occur from computing the derivative of an undefined-to-defined transition. On the second step and onward, the normal derivative computation is used.
Noise Sensitivity
Pure numerical differentiation amplifies high-frequency noise. If the input signal is noisy:
- Use the
filterCoefficientparameter (e.g., N=20) to add low-pass filtering - Alternatively, cascade with a separate low-pass filter block
- Or use the PIDController block which has a built-in derivative filter
Examples
Ramp Derivative (1 second simulation)
Linear ramp with slope 2 V/s goes into Derivative block. The output is a constant 2 V, showing that the derivative of a linear signal is its slope.
PID Controller D-Term
Connect the error signal to Derivative, scale with Gain, sum with P and I terms.
Remarks
- Pure Differentiation: Backward difference formula, optionally filtered
- Numerically Noisy: High-frequency content is amplified without filtering; use filterCoefficient to mitigate
- Essential for Control: Forms the D-term in proportional-integral-derivative controllers
- Inverse of Integrator: Complementary to the Integrator block for system analysis
- First Step: Always outputs 0 on the first step to avoid initialization spikes
See Also
- Integrator: Inverse operation (time integration)
- Gain: Signal scaling for proportional gain
- TransferFunction: General continuous-time dynamics
- PIDController: Has built-in filtered derivative