### Lag Compensator design with Bode plot

In the previous post  An Introduction to compensator Design with matlab we saw an introduction to compensators. In this post we will deal with lag compensator design with frequency domain specifications.

The steps to design the lag Compensator are

1. Determine K from the error constatns given
2. Sketch the bode plot
3. Determine phase margin if it is not satisfactory design lag compensator
4. take as the required phase margin to that add a tolerance of 5 so that new phase margin is 5. Find new gain cross over frequency which is the frequency corresponding to of previous step for that find from the bode plot determine corresponding to 6. Determine gain corresponding to from bode plotlet it be A db
7. a lag compensator has the form 8. since 9. 10. form the complete transfer function with the lag compensator added in series to th original system
11. plot the new Bode plot and determine phase margin and observe that it is the required phase margin

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 th text book the question has been solved without using matlab you can go through it to understand the steps better.

### Open loop transfer function and 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.

K=9600
d1=conv([1 4 0],[1 80]) % used to formulate the polynomial
G=tf(K,d1) % generate the transfer function.
margin(G)
pmreq=input('Enter Required Phase Margin') % enter 33 as given in question
pmreq=pmreq+5
phgcm=pmreq-180
wgcm=input('Enter new gain cross over frequency') % from the first bode plot use the mouse pointer and locate wgcm corresponding to phgcm.
[Beta,p]=bode(G,wgcm)
T=10/wgcm
Zc=1/T
Pc=1/(Beta*T)
Gc=tf([1 Zc],[1 Pc])
sys=Gc*G/Beta
margin(sys)

If you have any doubts please do contact me.

## 4 thoughts on “Lag Compensator design with Bode plot”

1. Ivan says:

Hello, Vineethkartha!

How can I compensate model by putting in the PID into the feedback? PID tuning, and automated matlab response optimisation bring no help///

Thanks.

2. Kishan Joshi says:
1. vineethkartha says:
3. Venkata Prasad says: