Documente Academic
Documente Profesional
Documente Cultură
COLLEGE,BHUJ 2018
CONTROL
SYSTEM ENGINEERING
B. E. - Semester -V
Electrical Engineering Department
CERTIFICATE
Date:
INDEX
Sr. Page
Title Date Sign
No. No.
1. Introduction to Control Systems. 1
EXPERIMENT-1
INTRODUCTION:
CONTROL SYSTEM:
FEEDBACK SYSTEM:
EXPERIMENT-2
MATLAB:
MATLAB
Built-in functions
E E
X X
Graphics T Computations T External Interface
R R
• 2-D Graphics • Linear Algebra (Mex-files)
• 3-D Graphics A • Data Analysis A
• Color & Lighting • Signal Processing • Interface with C and
F F FORTRAN Programs
• Animation • Polynomials and
U U
Interpolation
N • Quadrature N
C • Solution of ODEs C
TI TI
O O
N N
S S
Toolboxes
Development Environment.
It includes:
Graphics:
Development Environment:
MATLAB Desktop:
Command window:
Command History:
Simulink:
What Is Simulink?
Operation of Simulink:
2) From the File menu, point to New, and then click Model.
A blank Simulink model window opens.
Open New
Model
GUIDE stores GUIs in two files, which are generated the first
time we save or run the GUI:
Object
Menu
Alignment Browser
Editor
tool M-file Property
Editor Run
Inspector
Button
Figure
Resize Tab
Fig.2.8: Layout Editor
EXPERIMENT-3
A =
5 9 8
3 2 6
6 5 4
B=[3,2,5;2,1,3;3,2,1]
B =
3 2 5
2 1 3
3 2 1
C=A+B
C =
8 11 13
5 3 9
9 7 5
D=A- B
D =
2 7 3
1 1 3
3 3 3
E=A*B
E =
57 35 60
31 20 27
40 25 49
F=A\B
F =
G=A'
G =
5 3 6
9 2 5
8 6 4
H=A^(-1)
H =
J=det(A)
J =
130
K=eigs(A)
K =
15.7710
-2.3855 - 1.5976i
-2.3855 + 1.5976i
A =
1 0 2
0 1 0
3 2 0
B =
5 0 6
1 4 0
4 3 0
M=A&B
M = 1 0 1
0 1 0
1 1 0
(II) LOGICAL OR
N=A|B
N =
1 0 1
1 1 0
1 1 0
P=xor(A,B)
P = 0 0 0
1 0 0
0 0 0
F=~A
F = 0 1 0
1 0 1
0 0 0
P=zeros(3)
P =
0 0 0
0 0 0
0 0 0
Q=ones(3)
Q =
1 1 1
1 1 1
1 1 1
R=eye(3)
R =
1 0 0
0 1 0
0 0 1
S=size(R)
S =
3 3
T=linspace(1,5,10)
T =
Columns 1 through 7
Columns 8 through 10
U=0:4:8
U =
0 4 8
V=logspace(1,4,5)
V =
1.0e+004 *
(12)MATH FUNCTIONS
D =
4 5 6
5 9 7
1 5 3
A =
1.0e+003 *
B =
4 5 6
5 9 7
1 5 3
c =
1.0e+003 *
D =
4 5 6
5 9 7
1 5 3
E =
F =
EXPERIMENT-4
PROGRAM-1
clc;
clear all;
close all;
num=[1 1];
den=[1 -1];
TF=tf(num,den)
OUTPUT-1
Transfer function:
s+1
-----
s-1
PROGRAM-2
clc;
clear all;
close all;
num=[1 2 1];
den=[1 3 3 1];
TF=tf(num,den)
OUTPUT-2
Transfer function:
s^2 + 2 s + 1
---------------------
s^3 + 3 s^2 + 3 s + 1
clc;
clear all;
close all;
num=[1 2 0 3];
den=[1 0 9 3 1];
TF=tf(num,den)
OUTPUT-3
Transfer function:
s^3 + 2 s^2 + 3
---------------------
s^4 + 9 s^2 + 3 s + 1
PROGRAM-4
clc;
clear all;
close all;
num=[1 0 0 0 0 1];
den=[1 0 0 0 0 0 9];
TF=tf(num,den)
OUTPUT-4
Transfer function:
s^5 + 1
-------
s^6 + 9
PROGRAM-5
clc;
clear all;
close all;
num=[1 0 1];
OUTPUT-5
Transfer function:
s^2 + 1
-------
s^2 - 1
PROGRAM-6
clc;
clear all;
close all;
z=[0];
p=[-1 -2];
k=[10];
T=zpk(z,p,k)
OUTPUT-6
Zero/pole/gain:
10 s
-----------
(s+1) (s+2)
PROGRAM-7
clc;
clear all;
close all;
z=[ ];
p=[-1];
k=[1];
T=zpk(z,p,k)
Zero/pole/gain:
1
-----
(s+1)
PROGRAM-8
clc;
clear all;
close all;
z=[1 -1];
p=[1j -1j];
k=[1];
T=zpk(z,p,k)
OUTPUT-8
Zero/pole/gain:
(s-1) (s+1)
-----------
(s^2 + 1)
PROGRAM-9
clc;
clear all;
close all;
z=[-1 1];
p=[3 -9 -1];
k=[10];
T=zpk(z,p,k)
OUTPUT-9
Zero/pole/gain:
10 (s+1) (s-1)
-----------------
(s-3) (s+9) (s+1)
EXPERIMENT-5
AIM- FIND OUT THE OVERALL TRANSFER FUNCTION FOR THE GIVEN BLOCK
DIAGRAM USING MATLAB FUNCTIONS.
1.
1 𝑆+1
R(S) C(S)
500 𝑆 2 𝑆+2
C (S) S+1
Over All Transfer Function = = 3
R (S) 500 S +1000 S2
2.
R(S) 𝑆+1
𝑆+2 C(S)
+
𝑆+1
𝑆+5
C (S) 2S2+9S+7
Over All Transfer Function = =
R (S) S2+7S+10
3.
S 2 + 2𝑆 + 3
R(S) C(S)
S 2 + 9𝑆 + 23
__
1
𝑆+1
C (S) 3 2
Over All Transfer Function =
S
= 3
+3S +5S+3
2
R (S) S +11S 34S+26
4.
G1 G3
𝑆+2 𝑆+5 C(S)
R(S)
3S 2 + 𝑆 S 2 + 6𝑆 + 3
__
2
+
𝑆+7
G2
1
𝑆
H1
C (S) 4 3 2
Over All Transfer Function = =
7S +46S +69S +70S
6 5 4 3
R (S) 3S +40S +148S +115S +67S2+69S+70
clc,
clear all,
close all,
num1=[0 0 1];
den1=[500 0 0];
num2=[0 1 1];
den2=[0 1 2];
[num,den]=series(num1,den1,num2,den2)
printsys(num,den);
OUTPUT-1
s+1
------------------
PROGRAM-2
clc,
clear all,
close all,
num1=[0 1 1];
den1=[0 1 2];
num2=[0 1 1];
den2=[0 1 5];
[num,den]=parallel(num1,den1,num2,den2)
printsys(num,den);
OUTPUT-2
2 s^2 + 9 s + 7
---------------
s^2 + 7 s + 10
clc,
clear all,
close all,
num1=[1 2 3];
den1=[1 9 23];
num2=[0 0 1];
den2=[0 1 1];
[num,den]=feedback(num1,den1,num2,den2)
printsys(num,den);
OUTPUT-3
s^3 + 3 s^2 + 5 s + 3
------------------------
s^3 + 11 s^2 + 34 s + 26
PROGRAM-4
clc;
clear all;
close all;
num1=[0 1 2];
den1=[3 1 0];
G1=tf(num1,den1)
G2=tf([2],[1 7])
G3=tf([1 5],[1 6 3])
H1=tf([1],[1 0])
T1=parallel(G1,G2)
T2=series(T1,G3)
T=feedback(T2,H1,-1)
OUTPUT-4
Transfer function:
s+2
---------
3 s^2 + s
Transfer function:
-----
s+7
Transfer function:
s+5
-------------
s^2 + 6 s + 3
Transfer function:
Transfer function:
7 s^2 + 11 s + 14
--------------------
3 s^3 + 22 s^2 + 7 s
Transfer function:
7 s^3 + 46 s^2 + 69 s + 70
-----------------------------------------
Transfer function:
-------------------------------------------------------
EXPERIMENT-6
1. Obtain the state model for the system when the open loop
transfer function is given by
(𝑆+2)
T(s) = (𝑆+1)(𝑆+3)
PROGRAM-1
num = [1 2];
den = [1 4 3];
[A, B, C, D] = tf2ss(num,den)
p=[0 1;1 0];
%Phase variable form
Ap=inv(p)*A*p
Bp=inv(p)*B
Cp=C*p
Dp=D
OUTPUT-1
A =
-4 -3
1 0
B =
1
0
C =
1 2
D =
Ap =
0 1
-3 -4
Bp =
0
1
Cp =
2 1
Dp =
−𝟓 𝟏 𝟏
A=� � , B= � � , C=[𝟐 𝟏], D=0
−𝟔 𝟎 𝟐
PROGRAM-2
clc
A=[-5 1;-6 0];
B=[1;2];
C=[2 1];
D=0;
[num,den]=ss2tf(A,B,C,D)
printsys (num,den)
OUTPUT-2
num =
0 4 8
den =
1 5 6
num/den =
4 s + 8
-------------
s^2 + 5 s + 6
PROGRAM-3
num = [ 1 ];
den = [ 1 2 5];
[A, B, C, D] = tf2ss(num,den)
p=[0 1;1 0];
%Phase variable form
Ap=inv(p)*A*p
Bp=inv(p)*B
Cp=C*p
Dp=D
OUTPUT-3
A =
-2 -5
1 0
B =
1
0
C =
0 1
D =
0
Ap =
0 1
-5 -2
Bp =
0
1
Cp =
1 0
Dp =
EXPERIMENT-7
PROGRAM
% Program for the generation of unit impulse signal
clc;
clear all;
close all;
t=-2:1:2;%
y=[zeros(1,2),ones(1,1),zeros(1,2)];
subplot(2,2,1);
stem(t,y);
ylabel('Amplitude --.');
xlabel('(a) n --.');
OUTPUT
enter the N value= 4
clc
n1=input('enter the length of ramp sequence=');
t=0:n1;
subplot(2,2,3);stem(t,t);ylabel('Amplitude -->');
xlabel('(c) n -->');
OUTPUT
enter the length of ramp sequence=5
OUTPUT
enter the length of exponential sequence7
Enter the a value=1
1 Amplitude --> 1
Amplitude --.
0.5 0.5
0 0
-2 -1 0 1 2 0 2 4 6
(a) n --. (b) n -->
8 1500
6
Amplitude -->
Amplitude -->
1000
4
500
2
0 0
0 2 4 6 8 0 2 4 6 8
(c) n --> (d) n -->
EXPERIMENT-8
PROGRAM-1
clc,
clear all,
close all,
num=[1];
den=[1 1];
t=tf(num,den);
step(t);
OUTPUT-1
Step Response
1
System: t
System: t Final Value: 1
Settling Time (sec): 39.1
System: t
Rise Time (sec): 22
0.8
0.6
Amplitude
0.4
0.2
0
0 10 20 30 40 50 60
Time (sec)
PROGRAM-2
clc,
clear all,
close all,
num=[1];
den=[1 1];
t=tf(num,den);
impulse(t);
Impulse Response
1
System: t
Peak amplitude: 1
At time (sec): 0
0.9
0.8
0.7
0.6
Amplitude
0.5
0.4
0.3
0.2
0.1 System: t
Settling Time (sec): 3.91
0
0 1 2 3 4 5 6
Time (sec)
PROGRAM-3
clc,
clear all,
close all,
num=[1];
den=[10 1];
t1=tf(num,den);
num=[1];
den=[100 1];
t2=tf(num,den);
num=[1];
den=[1000 1];
t3=tf(num,den);
step(t1,t2,t3);
Step Response
1
System: t3
System: t2 System: t3 Final Value: 1
Settling Time (sec): 391 Settling Time (sec): 3.91e+003
System: t2 System: t3
Rise Time (sec): 220 Rise Time (sec): 2.2e+003
0.8
0.6
Amplitude
0.4
0.2
0
0 1000 2000 3000 4000 5000 6000
Time (sec)
PROGRAM-4
clc;
clear all;
close all;
t=0:0.2:10;
zeta=[0 0.2 0.4 0.6 0.8 1];
for n=1:6
num=[1];
den=[1 2*zeta(n) 1];
[y(1:51,n),x,t]=step(num,den,t);
end
plot(t,y);
grid;
title('Plot of unit step response curve
with\omega_n=1and\zeta=0,0.2,0.4,0.6,0.8,1')
xlabel('t(sec)');
ylabel('response');
text(3.2,1.9, '\zeta=0');
text(3.2,1.5, '\zeta=0.2');
text(3.5,1.3, '\zeta=0.4');
text(3.5,1.1, '\zeta=0.6');
text(3.5,1.0, '\zeta=0.8');
text(3.5,0.9, '\zeta=1.0');
1.5 ζ=0.2
ζ=0.4
response
ζ=0.6
1 ζ=0.8
ζ=1.0
0.5
0
0 1 2 3 4 5 6 7 8 9 10
t(sec)
Unit ramp response of the second order system:
PROGRAM-5
clc;
clear all;
close all;
num=[2 1];
den=[1 1 1 0];
t=0:0.1:10;
c=step(num,den,t);
plot(t,c,'D',t,t,'h');
xlable('t (sec)');
ylable('output response');
title('unit ramp response for G(s)=2s+1/(s^2+s+1)');
10
output response
0
0 1 2 3 4 5 6 7 8 9 10
t(sec)
EXPERIMENT-9
1. Sketch the root locus plot for the system when the open loop
transfer function is given by
1
G(s) = 𝑆(𝑆+3)(𝑆+6)
PROGRAM-1
clc;
clear all;
num=[1];
den=[1 9 18 0];
t=tf(num,den);
rlocus(t)
OUTPUT-1
Root Locus
15
10
5
Imaginary Axis
-5
-10
-15
-20 -15 -10 -5 0 5
Real Axis
2. Sketch the root locus plot for the system when the open loop
transfer function is given by
𝐾
G(s) = 𝑆(𝑆+4)(𝑆 2 +4𝑆+13)
PROGRAM-2
p=1;
q= [1 8 29 52 0];
sys4=tf(p,q)
rlocus(p,q)
OUTPUT-2
Transfer function:
1
---------------------------
s^4 + 8 s^3 + 29 s^2 + 52 s
Root Locus
10
2
Imaginary Axis
-2
-4
-6
-8
-10
-12 -10 -8 -6 -4 -2 0 2 4 6 8
Real Axis
3. Sketch the root locus plot for the system when the open loop
transfer function is given by
(𝑆+5)
G(s) = 𝑆 2 +7𝑆+25
PROGRAM-3
clc;
clear all;
num=[1 5];
den=[1 7 25];
t=tf(num,den);
rlocus(t)
OUTPUT-3
Root Locus
5
1
Imaginary Axis
-1
-2
-3
-4
-5
-18 -16 -14 -12 -10 -8 -6 -4 -2 0 2
Real Axis
EXPERIMENT-10
1. Sketch the bode plot for the transfer function given Unity
Feedback Control System using MATLAB.
15
G(s) = 𝑠(𝑠+3)(0.7𝑠+5)
PROGRAM-1
clf
num = 15;
den = conv([1 0], conv([1 3],[0.7 5]));
bode(num, den)
OUTPUT-1
Bode Diagram
50
0
Magnitude (dB)
-50
-100
-150
-90
-135
Phase (deg)
-180
-225
-270
-1 0 1 2 3
10 10 10 10 10
Frequency (rad/sec)
2. Sketch the bode plot for the transfer function given below:
𝟐(𝒔+𝟎.𝟐𝟓)
G(s) H(s) =
𝒔𝟐 (𝒔+𝟏)(𝒔+𝟎.𝟓)
PROGRAM-2
num=[2 0.5]
den=[1 1.5 0.5 0]
sys=tf(num,den)
margin(sys
OUTPUT-2
Bode Diagram
Gm = Inf dB (at Inf rad/sec) , Pm = 50.5 deg (at 1.2 rad/sec)
50
Magnitude (dB)
-50
-100
-45
Phase (deg)
-90
-135
-180
-2 -1 0 1 2
10 10 10 10 10
Frequency (rad/sec)
PROGRAM-3
num=[50 5];
den=[1 8 15 0];
G=tf(num,den);
bode (G)
title ('System 1')
%title (‘System 1’)
pause
%Find phase margin
[Gm, Pm, Wcg, Wcp] = margin (G);
w = 1:.01:20;
[M, P, w] =bode (G, w);
%Find bandwidth
for k = 1:1: length (M);
if 20*log10 (M (k)) +7<=0;
'Mag'
20*log10 (M (k))
'BW'
wBW = w(k)
break
end
end
%Find damping ratio, percent overshoot, settling time, and peak
time
for z = 0:.01:10
Pt = atan (2*z/ (sqrt (- 2*z^2 + sqrt (1 + 4*z^4))))*(180/pi);
if (Pm -Pt) <= 0
z;
Po = exp (- z*pi/sqrt (1 - z^2));
Ts = (4/ (wBW*z))*sqrt ((1 - 2*z^2) + sqrt (4*z^4 - 4*z^2 +
2));
Tp = (pi/ (wBW*sqrt (1 - z^2)))*sqrt ((1 - 2*z^2) + sqrt (4*z^4
- 4*z^2 + 2));
fprintf ('Bandwidth = %g', wBW)
fprintf ('Phase margin = %g', Pm)
fprintf (' Damping ratio = %g', z)
fprintf (' Percent overshoot = %g', Po*100)
fprintf (' Settling time = %g', Ts)
Government Engg. College, Bhuj Page 67
Control System Engineering (2150909) B. E. Electrical Sem-5th
OUTPUT-3
System 1
100
50
Magnitude (dB)
-50
-100
0
-45
Phase (deg)
-90
-135
-180
-3 -2 -1 0 1 2 3
10 10 10 10 10 10 10
Frequency (rad/sec)
Mag =
-7.0023
wBW =
9.7600
Bandwidth = 9.76
Phase margin = 67.1233
Damping ratio = 0.74
Percent overshoot = 3.1544
Settling time = 0.528125
Peak time= 0.456349