Control System Lab
Control System Lab
1.
s+1 s+1
g1 = ------- g2 = --------- C(S)
500 s^2 s+2
R(S)
PROGRAM :
num1=[1 1];
den1=[500 0 0];
num2=[1 1];
den2=[1 2];
[num,den] = series(num1,den1,num2,den2);
Printsys(num,den)
Output:
s^2 + 2 s + 1
num/den = ----------------------------
500 s^3 + 1000 s^2
02.
s+1
R(S) g1 = ------- C(S)
500 s^2
s+1
g2 = ---------
s+2
PROGRAM :
num1=[1 1];
den1=[500 0 0];
num2=[1 1];
den2=[1 2];
[num,den] = feedback(num1,den1,num2,den2);
Printsys(num,den)
Output:
s^2 + 3 s + 2
num/den = ----------------------------------------
500 s^3 + 1001 s^2 + 2 s + 1
03.
s+1
R(S) g1 = ------- C(S)
500 s^2
s+1
g2 = ---------
s+2
PROGRAM :
num1=[1 1];
den1=[500 0 0];
num2=[1 1];
den2=[1 2];
[num,den] = parallel(num1,den1,num2,den2);
printsys(num,den)
Output:
s+1 s+7
g2 = --------- g5 = ---------
s+2 s+5
PROGRAM :
num1=[1 1];
den1=[500 0 0];
num2=[1 1];
den2=[1 2];
num3=[1 3];
den3=[1 5];
num4=[1 5];
den4=[700 0 0];
num5=[1 7];
den5=[1 5];
g1=tf(num1,den1);
g2=tf(num2,den2);
g3=tf(num3,den3);
g4=tf(num4,den4);
g5=tf(num5,den5);
h1=parallel(g1,g2);
h2=feedback(g4,g5);
h3=series(h1,g3);
h4=series(h3,h2);
ans=minreal(h4)
Output:
Transfer function:
0.001429 s^4 + 0.005717 s^3 + 0.004303 s^2 + 3.143e-005 s + 1.714e-005
----------------------------------------------------------------------------------------------------
s^5 + 2.001 s^4 + 0.01286 s^3 + 0.02 s^2
EXPERIMENT NO 2:-
Implement Signal Flow graph to obtain transfer function a control
system.
Program
% Define transfer functions
G = tf([1], [1, 1]); % G(s) = 1 / (s + 1)
H = 1; % H(s) = 1
Output:
EXPERIMENT NO 3:-
Simulation of poles and zeros of a transfer function.
Program:
num=[1 2];
den=[1 7 12];
H=tf(num,den);
Z=zero(H);
P=pole(H);
pzmap(H);
sgrid
Output:
EXPERIMENT NO 4:-
Implement time response specification of a second order Under
damped System, for different damping factors.
Program:
zeta=0.5;
wn=6;
num=[36];
den=[1 6 36];
g=tf(num,den);
wd=wn*sqrt(1-zeta*zeta);
theta=atan(sqrt(1-zeta*zeta)/zeta);
tr=(pi-theta)/wd;
tp=pi/wd;
mp=exp(-zeta*pi/sqrt(1-zeta*zeta))*100;
ts=4/(zeta*wn);
step(g);
xlabel('time (t)');
ylabel('Response c(t)');
title('step response of second order system');
Output:
EXPERIMENT NO 5:-
Implement frequency response of a second order System.
Program
num=[10];
den=[1 6 10];
w=0:0.01:pi;
h=freqz(num,den,w);
mag=abs(h);
phase=angle(h);
figure
subplot(2,1,1);
plot(w,mag);
xlabel('frequency');
ylabel('Magnitude');
title('frequency response of control system');
grid on
subplot(212);
plot(w,phase)
grid on
xlabel('phase');
ylabel('Magnitude');
title('phase response of control system');
Output:
EXPERIMENT NO 6:-
Implement a frequency response of a lead lag Compensator
Lead compensator:
Design a lead compensator for a unity feedback system with open
loop transfer function G(s)= K/(s(s+1)(s+5)) to satisfy the following
specifications (i) velocity error constant Kv=50, (ii) Phase margin =20
degrees.
% Given open-loop transfer function
num = [250];
den = [1 6 5 0];
G = tf(num, den);
figure(3)
subplot(2, 1, 1)
step(Gc1u, '--r')
grid on
title('Uncompensated system step response')
subplot(2, 1, 2)
step(Gclc, '-')
grid on
title('Compensated system step response')
Outputs:
Lag compensator:
The open loop transfer function of certain unity feedback control
system is given by G(s)=K/(s(s+4)(s+80)). It is desired to have the
phase margin to be atleast 33 degree and the velocity error
constant =30/sec. Design Lag compensator.
Outputs:
EXPERIMENT NO 7:-
Analyze the stability of the given system using Routh stability
criterion.
% define the coeffient of the characteristics equation
coeff=[1,3,2,1,5];
% length of the characteristics eqation
n=length(coeff);
%initialize the routh array
routh=zeros(n,ceil(n/2));
% fill in the first two rows of the routh array
routh(1,:)= coeff(1:2:end);
if n>1
routh(2,1:length(coeff(2:2:end)))= coeff(2:2:end);
end
% fill the rest of the routh array
for i=3:n
for j=1:ceil(n/2)-1
routh(i,j)=-det([routh(i-2,1) routh(i-2,j+1); routh(i-1,1) routh(i-1,j+1)])/ routh(i-
1,1);
end
%specila case when the element in the first column becomes zero
if routh(i,1)==0
routh(i,1)=eps;
end
end
% stability based on the routh array
stable=all(routh (:,1)>0);
% display stability result
disp('Routh array');
disp(routh);
if stable
disp('The system is stable (all elements in the first column are positive ).');
else
disp('The system is unstable ( there are no positive element in the next
column.)');
end
Output:
Routh array
1.0000 2.0000 5.0000
3.0000 1.0000 0
1.6667 5.0000 0
-8.0000 0 0
5.0000 0 0
Output: