Note: This page has been translated by MathWorks. Please click here

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Output time derivative of input

Continuous

The Derivative block approximates the derivative
of the input signal * u* with respect to the simulation
time

$$\frac{du}{dt},$$

by computing a numerical difference $$\Delta u/\Delta t,$$where $$\Delta u$$ is the change in input value and $$\Delta t$$ 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:

$$y(t)=\frac{\Delta u}{\Delta t}=\frac{u(t)-u({T}_{previous})}{t-{T}_{previous}}|t>{T}_{previous},$$

where * t* is the current simulation time and $${T}_{previous}$$ 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 very 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 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 step size and improve accuracy of the simulation. 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 settings 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.

When 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, as follows:

$$y(k)=\frac{1}{\Delta t}(u(k)-u(k-1))$$

Taking the *z*-transform of this equation
results in:

$$\frac{Y(z)}{u(z)}=\frac{1-{z}^{-1}}{\Delta t}=\frac{z-1}{\Delta t\cdot z}.$$

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.

The Laplace domain transfer function for the operation of differentiation is:

$$\raisebox{1ex}{$Y(s)$}\!\left/ \!\raisebox{-1ex}{$X(s)$}\right.=s$$

This equation is not a proper transfer function, nor does it
have a state-space representation. As such, the Simulink^{®} software
linearizes this block as an effective gain of 0 unless you explicitly
specify that a proper first-order transfer function should be used
to approximate the linear behavior of this block (see Coefficient c in the transfer function approximation s/(c*s
+ 1) used for linearization).

To improve linearization, you can also try to incorporate the derivative term in other blocks. For example, if you have a Derivative block in series with a Transfer Fcn block, try using a single Transfer Fcn block of the form

$$\frac{s}{s+a}.$$

For example, you can replace the first set of blocks in this figure with the blocks below them.

The Derivative block accepts and outputs a real signal of type `double`

.
For more information, see Data Types Supported by Simulink.

Specify the time constant * c* to approximate
the linearization of your system.

**Default:** `inf`

The exact linearization of the Derivative block is difficult, because the dynamic equation for the block is $$y=\dot{u}$$, which you cannot represent as a state-space system. However, you can approximate the linearization by adding a pole to the Derivative to create a transfer function $$s/(c\ast s+1).$$ The addition of a pole filters the signal before differentiating it, which removes the effect of noise.

The default value

`inf`

corresponds to a linearization of`0`

.

A best practice is to change the value of

to$${\scriptscriptstyle \frac{1}{{f}_{b}}}$$, where $${f}_{b}$$ is the break frequency for the filter.*c***Coefficient c in the transfer function approximation s/(c*s+1) used for linearization**must be a finite positive value. This value must be nonzero.

Parameter: `CoefficientInTFapproximation` |

Type: character vector |

Value: `'inf'` |

Default: `'inf'` |

Data Types | Double |

Sample Time | Continuous |

Direct Feedthrough | Yes |

Multidimensional Signals | No |

Variable-Size Signals | No |

Zero-Crossing Detection | No |

Code Generation | Yes |

Was this topic helpful?