# Matlab Derivative block analysis and filter design

May someone helps me regarding this!?

I have a controller which will control AC motor as attached. In this controller, a stage comes where I need to use a Derivative Block before point 'B' as shown in the attached picture "controller block diagram" in the attached link at the end of the this post. Now this derivative block adds some noise and fluctuation to the output of the system and I got the reason that why it happens. The reason is below:

"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. The exact linearization of the Derivative block is difficult because the dynamic equation for the block is y=˙u, which you cannot represent as a state-space system. The Laplace domain transfer function for the operation of differentiation is: Y(s)/X(s)=s This equation is not a proper transfer function, nor does it have a state-space representation. However, you can approximate the linearization by adding a pole to the Derivative to create a transfer function s/(c∗s+1). The addition of a pole filters the signal before differentiating it, which removes the effect of noise. A best practice is to change the value of c to1/fb, where fb is the break frequency for the filter" [ https://www.mathworks.com/help/simulink/slref/derivative.html#br3m9zv-1 ].

The reference above is from official Matlab Website which is 100% verified by Matlab, so we can totally rely on it.

Now my question here is if I follow the above reference and I replace my derivative block with filter $\frac{s}{c*s+1}$ where $c=\frac{1}{fc}$. HOW SHOULD I CHOOSE OR DESIGN THE VALUE OF $fc$? I also have the expected output signal characteristics and the bode plot as attached in the following link [ https://drive.google.com/open?id=0B9NQhKDld_D4T0xwZTdZY1V6NHM ].

Yes, filter all signals before taking derivatives. Place the filter poles somewhere between the system's time constantes and the frequencies where noise is concentrated. More details depend on the designer's knowledge about the specific process to be controlled.

• Thank You very much for your reply. so actually in the system, the settling time is increased because of the derivative block so can i choose the fc based on the expected settling time of the waveform? or i am wondering that how can i know that which frequencies contain noise becouse i can only see the waveform that it contain fluctuations. – Abdul Wali Jul 30 '17 at 17:06
• The derivative block amplifies noise (look at the Bode plot of $s$ to see why). The necessary filter will slow down response. If you are working on simulation, test and check what works better. If it's a real process, then you need to understand the frequency distribution of the noise. – Pait Jul 31 '17 at 12:54