What are the implications of using the Derivative block in Simulink?

129 views (last 30 days)
I have tried using the Derivative block in Simulink and have generally found that it can lead to complications. I usually try to restructure my model to avoid the use of Derivative blocks, but that is sometimes difficult to do. In that case, what are some best practices for using the Derivative block, or should I consider using a different type of block or transfer function? If so, what are some possible alternatives?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 18 Oct 2013
Here is a list of recommendations on the usage of the Derivative block:
1) Signals connected to the Derivative block should be continuous in time and amplitude
Derivative blocks amplify discontinuities when connected to a non-continuous signal. In example 'Example1_Discont.mdl', the slope of the input signal changes instantly. After being passed through a Derivative block, it becomes a peak.
2) Signals connected to the Derivative block should have a small derivative at t=0
‘Example2_Spike.mdl’ shows how a spike can occur in the second derivative after the first time step. This occurs because the Derivative block yields 0 by default at the initial time step, instead of 2*pi in this case. If this model is simulated again with a smaller time step, the spike amplitude increases.
3) Signals connected to the derivative should contain a low level of noise
In general, taking the derivative of a noisy signal tends to exacerbate the influence of that noise. Therefore, Derivative blocks in Simulink exhibit this behavior as well. In ‘Example3_Noise.mdl’, the noise gets amplified in the output, to the point where the derivative of the sine wave is not recognizable. By using a filtered derivative transfer function which filters out higher frequencies, a much better result can be obtained in the example.
If your model cannot respect the above guidelines, you might want to consider the following alternatives:
a) Rearranging the equations
Typically, a system's best-form mathematical model exclusively involves integrators (i.e., no derivatives). It is usually possible to design the model in such a way that Derivative blocks are never needed. In 'Example4_BestForm.mdl', the "naive" first approach involves a Derivative block; however, the second approach avoids having to compute the derivative.
b) Including the derivative into a transfer function
If a Derivative block and another Transfer Function block are in series, it may be possible to remove the Derivative block and multiply the numerator of the transfer function by ‘s’ (see ‘Example5_InSeries.mdl’, where the magnitude of the error is very small compared to the magnitude of the output signal).
c) Filtered derivative
The Derivative block can be replaced with a transfer function of the form G(s) = s/(tau*s+1), where ‘tau’ is a time constant which should be small compared to the dominant time constant of the system, to avoid filtering out important system dynamics. ‘Example6_Filtered.mdl’ contrasts this transfer function with the Derivative block.
* Additional note:
How is the derivative part of the PID controller implemented in Simulink? It does not use a Derivative block, but instead implements a filtered derivative similar to the one described above. In a model including a PID Controller block, right-click on the block and select ‘Look Under Mask’ to see the exact implementation of the controller, and in particular its derivative part.

Sign in to comment.

More Answers (2)

Prachi Thombare
Prachi Thombare on 29 Oct 2022
Block 'old_counter/Derivative' is not supported for HDL code generation. To continue with code generation, comment out this block.

Kiran Kintali
Kiran Kintali on 30 Oct 2022
Prachi, You need to use discrete blocks suitable for HDL code generation.


No tags entered yet.




Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!