Output time derivative of input
Simulink / Continuous
The Derivative block approximates the derivative of the input signal u with respect to the simulation time t. You obtain the approximation of
by computing a numerical difference where is the change in input value and is the change in time since the previous simulation (major) time step.
This block accepts one input and generates one output. The initial output for the block is zero.
The precise relationship between the input and output of this block is:
where t is the current simulation time and is the time of the last output time of the simulation. The latter is the same as the time of the last major time step.
The Derivative block output might be sensitive to the dynamics of the entire model. The accuracy of the output signal depends on the size of the time steps taken in the simulation. Smaller steps allow for a smoother and more accurate output curve from this block. However, unlike with blocks that have continuous states, the solver does not take smaller steps when the input to this block changes rapidly. Depending on the dynamics of the driving signal and model, the output signal of this block might contain unexpected fluctuations. These fluctuations are primarily due to the driving signal output and solver step size.
Because of these sensitivities, structure your models to use integrators (such as Integrator blocks) instead of Derivative blocks. Integrator blocks have states that allow solvers to adjust the step size and improve simulation accuracy. See Circuit Model for an example of choosing the best-form mathematical model to avoid using Derivative blocks in your models.
If you must use the Derivative block with a variable step solver, set the solver maximum step size to a value such that the Derivative block can generate answers with adequate accuracy. To determine this value, you might need to repeatedly run the simulation using different solver settings.
If the input to this block is a discrete signal, the continuous derivative of the input exhibits an impulse when the value of the input changes. Otherwise, it is 0. Alternatively, you can define the discrete derivative of a discrete signal using the difference of the last two values of the signal:
.
Taking the z-transform of this equation results in:
The Discrete Derivative block models this behavior. Use this block instead of the Derivative block to approximate the discrete-time derivative of a discrete signal.
Data Types |
|
Direct Feedthrough |
|
Multidimensional Signals |
|
Variable-Size Signals |
|
Zero-Crossing Detection |
|