# Lead Compensator design with Bode plot

#### Introduction to Matlab

#### Lag Compensator with Bode Plot

#### Lag Compensator with root locus

The steps to design the Lead Compensator are:

- Determine K from the error constants given
- Sketch the bode plot
- Determine phase margin
- 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 - calculate

from bode plot find such that it is the frequency corresponding to the gain

- calculate

- a lead compensator has the form

- form the complete transfer function with the lead compensator added in series to th original system
- plot the new Bode plot and determine phase margin and observe that it is the required phase margin
- 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(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 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

‘Cascade’

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’)

Posted on May 24, 2012, in Technical and tagged Btech, control system Kerala university, Electrical, matlab script. Bookmark the permalink. 1 Comment.

thank you