# 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 1/cs+1 where c=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 ].

• If signal is RPM (Hz) and Noise is above this then choose fc such that phase shift is <45deg above RPM frequency as this delay affects close loop gain margin and stability. s/(c∗s+1), so there is a tradeoff between stability and noise rejection. – Sunnyskyguy EE75 Jul 30 '17 at 16:08
• You should never say that you can totally rely on something. There is always a possibility that the documentation contains mistakes. – MrYouMath Oct 6 '17 at 5:43

Matlab quidance tries to suggest to replace the derivative by a block which is like RC-high-pass filter. At low enough frequencies that block approximates the derivative, but does not boost high frequencies. Term s alone would grow infinitely along the frequency. Using derivative boosts noise and in feedback systems it's a perfect call for numerical instability.

There's no need to insert that approximation into your wanted transfer fuction because it is already included. You can see it easily by rearranging the terms. Only separate terms sT and 1.

Here is an example how to calculate your transfer function without the derivative. Two integrators (1/s) are needed. Here's one snag: The leftmost integrator can get charged infinitely, if this is not a part of a system which keeps the average of Vin equal to zero.

If you cannot quarantee zero average Vin, it would be better to develop separately sT/(s+1) and 1/(s+1) in their own one integrator feedback loops. Finally make a sum and multiply by 1/k.

You should noticae that sT/(s+1) is the included approximated derivative and 1/(s+1) is like an RC integrator which discharges itself gradually.

• thanks a lot. can you please also get the final transfer function of the following system for me, i got a transfer function but i think i am getting it wrong. drive.google.com/open?id=0B9NQhKDld_D4eGpwTEhseHEtMkE – Abdul Wali Aug 3 '17 at 13:55
• This sounds like you are fighting with a homework, not making an actual design. You seem to be achieving a proper block diagram for a transfer function but explaining it as a trial to find the right transfer function. Refute this by showing your full calculation of the unsure transfer function. – user287001 Aug 3 '17 at 15:21