Control Systems
Control Systems
(b)
clc PI Controller
clear all ki=10;kp=10;
close all numI=[kp ki];
p=4 denI=[1 0];
q=[1 1 2] dr=conv(denI,den);
a=tf(p,q) display(‘Transfer function of PI controller with
r=[1 0] out FB’);
s=[1 2] sys2=tf(numI,dr)
b=tf(r,s) display(‘Transfer function of PI controller with
c=series(a,b) G2=feedback(sys2,1)
ans=feedback(c,1,-1) m=step(G2);
subplot(2,3,4);plot(m);
k=degain(G2)
time(‘PI control Kp=10 and Ki=10’)
PD Controller
Kd=10;
numc=[Kd Kd];
nr=conv(num,numc);
display(‘Transfer function for PD controller with out FB’);
sys1=tf(nr,den)
display(‘Transfer function for PD controller with FB’);
G1=feedback(sys1,1)
m=step(G1);
subplot(2,3,3);plot(m);
title(‘PD control Kp=10 and Kd=10’)
2.(a) 2.(b)
3.(a) 3.(b)
T_lead=0.1;
T_lag=10;
num=[T_lead 1];
den=[T_lag 1];
compensator=tf(num,den);
w=logspace(-2,2,500);
[mag,phase,w]=bode(compensator,w);
magdB=20 * log10(mag);
phaseDeg=phase * (180/pi);
figure;
subplot(2,1,1);
semilogx(w,squeeze(magdB));
grid on;
title(‘Magnitude Response of Lead-Lag Compensator’);
xlabel(‘Frequency (rad/s)’);
ylabel(‘Magnitude(dB)’);
subplot(2,1,2);
semilogx(w,squeeze(phaseDeg));
grid on;
title(‘Phase Response of Lead-Lag Compensator’);
xlabel(‘Frequency (rad/s’);
ylabel(‘Phase (degrees)’);
6.(b)