# 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 , where is the required phase margin and is 5 initially. if the angle is greater than 60then we have to design the compensator as 2 cascade compensator with lead angle as 5. calculate from bode plot find such that it is the frequency corresponding to the gain 6. calculate 7. a lead compensator has the form 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 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 the phase margin should be atleast 33 and velocity error constant is 30.

Solution:
The velocity error constant is 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=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
ph=Pd-Pm+ep
if ph>60   % check if angle needed is greater than 60
phm=ph/2
else
phm=ph
end

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
T=1/(wm*sqrt(alpha))
Gc=tf([1 1/T],[1 1/(alpha*T)]) % form transfer function of compensator
‘Open Loop Transfer Function is’
if ph==phm
‘Single’
Go=Gc*G/alpha
else
Go=Gc*Gc*G
%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
end

margin(Go)
pause
comp=feedback(Go,1,-1);
uncomp=feedback(G,1,-1);
step(uncomp) % observe step response
hold on
step(comp)
legend(‘Uncompensated’,’Compensated’) Hi, I am Vineeth Kartha, I hold a Masters degree in Embedded Systems from BITS Pilani, Goa Campus. I currently work as a Software Developer. I am A free software promoter and electronics hobbyist. In my free time I do a little bit of birding and Wildlife photography. I love travelling, reading and blogging.

Posted on May 24, 2012, in Technical and tagged , , , . Bookmark the permalink. 2 Comments.

1. svk
2. SIPON DAS