Comsats University Islamabad Abbottabad Campus Lab Assigment
Comsats University Islamabad Abbottabad Campus Lab Assigment
Comsats University Islamabad Abbottabad Campus Lab Assigment
Submitted By:
YASEEN AYAZ
Registration No:
FA18-BCE-020
Course:
CONTROL SYSTEM
Submitted To:
Dr. BILAL KHAN
Date:
April 7, 2021
Task 1:
For the following systems represented by the transfer function G(s), plot the step
response in MATLAB and find the Rise time, Peak time, % overshoot and settling time.
9
1. G1= S + 2 S+ 9
2
CODE:
clear all
close all
clc
s=tf('s');
G1=9/((s^2)+(2*s)+9);
figure;
legend('G1');
grid on;
step(G1);
OUTPUT:
1|Page
9
2. G2= S + 3 S+ 9
2
CODE:
clear all
close all
clc
s=tf('s');
G2=9/((s^2)+(3*s)+9);
figure;
step(G2);
legend('G2');
grid on;
OUTPUT:
6
3. G3= S + 5 S+ 6
2
2|Page
CODE:
clear all
close all
clc
s=tf('s');
G3=6/((s^2)+(5*s)+6);
figure;
step(G3);
legend('G3');
grid on;
OUTPUT:
3|Page
9
4. G4= S + S 4 +3 S+9
2 2
CODE:
clear all
close all
clc
s=tf('s');
G4=9/((s^3)+(4*s^2)+(3*s)+9);
figure;
step(G4);
legend('G4');
grid on;
OUTPUT:
4|Page
Task 2:
For the below mentioned block diagram, plot the step response for the closed-loop transfer
function C(s)/R(s).
OUTPUT:
5|Page
2. Find the value of K for which the settling time is 5 secs.
CODE:
% DONE BY YASEEN BCE-020
clear all
close all
clc
s=tf('s');
G1=1/(s*(s+2)*(s+3));
H1=s;
G=feedback(G1,H1);
k=1;
kt=0;
for k=1:0.1:100
Gc=feedback(k*G,1);
S=stepinfo(Gc);
if(S.SettlingTime>4.9 && S.SettlingTime<=5)
kt=k;
break;
6|Page
end
end
figure;step(feedback(kt*G,1))
stepinfo(feedback(kt*G,1))
OUTPUT:
7|Page
close all
clc
s=tf('s');
G1 = 1/(s*(s+2)*(s+3))
H1 = s;
G = feedback(G1,H1);
K=1;
Kt=0;
for K=1:0.1:100
Gc=feedback(K*G,1);
S=stepinfo(Gc);
if(S.RiseTime>0.5&&S.RiseTime<=1)
Kt=K;
break;
end
end
figure;
step(feedback(Kt*G,1));
stepinfo(feedback(Kt*G,1));
OUTPUT:
8|Page
9|Page