Lead Compensator design with Bode plot

The steps to design the Lead Compensator are:

  1. Determine K from the error constants given
  2. Sketch the bode plot
  3. Determine phase margin 
  4. The amount of phase angle to be contributed by lead network is
    $\phi_m=\gamma_{d}-\gamma + \epsilon$, where $\gamma_d$ is the required phase margin and $\epsilon$ is 5 initially. if the angle is greater than 60then we have to design the compensator as 2 cascade compensator with lead angle as $\phi_m/2$
  5. calculate
    $\alpha=\frac{1-sin(\phi_m)}{1+sin(\phi_m)}$ from bode plot find $\omega_m$ such that it is the frequency corresponding to the gain
  6. calculate
    $T=\frac{1}{\omega_m \sqrt(\alpha)}$
  7. a lead compensator has the form
    $\frac{(s+\frac{1}{T})}{(s+\frac{1}{\alpha T})}$
  8. form the complete transfer function with the lead compensator added in series to th original system
  9. plot the new Bode plot and determine phase margin and observe that it is the required phase margin
  10. if not satisfactory repeat steps from step 4 by changing value of $\epsilon$ by 5

Now to do this In Matlab let us take a question. I will be solving the question number 6.2 in Control Systems By Nagoor Kani. In the text book the question has been solved without using matlab you can go through it to understand the steps better.

The question is
$G(s) = \frac{K}{s(s+4)(s+80)}$ the phase margin should be atleast 33 and velocity error constant is 30.

The velocity error constant is
$K_v=\lim_{s \to 0}sG(s)H(s)$
On solving we get K =9600

The code below shows the matlab commands to obtain the design.

clear all  % clear all variables
close all  % close all previous graphs
K=9600	% value of K calculated from error constants
'G(s)' % Display heading
G=tf(K,conv([1 4 0],[1 80])) % make the transfer function
[Gm,Pm]=margin(G) %get the gain margin and phase margin
margin(G) %plot the bode plot
Pd=input('Enter Desired Phase margin')
ep=input('Enter value e') % enter the value of epsilon initially start with 5
if ph>60   % check if angle needed is greater than 60

alpha=(1-sind(phm))/(1+sind(phm)) % calculate alpha
db=-20*log10(1/sqrt(alpha)) %calculate the gain in db
wm=input(‘Enter frequency’) % from plot obtain frequency corresponding to above gain
Gc=tf([1 1/T],[1 1/(alpha*T)]) % form transfer function of compensator
‘Open Loop Transfer Function is’
if ph==phm
%if angle was greater than 60 we designed compensator for half value so we cascade them and their attenuation is not nullified and should be retained

step(uncomp) % observe step response
hold on

Step response of compensated and Uncompensated system



3 thoughts on “Lead Compensator design with Bode plot

  1. Akash

    Sir can you please give your contact mail.Can you please send the “Lead Compensator design with Bode plot” in .m file.
    Thank you.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s