Control System File
Control System File
PRACTICAL FILE
ON
1
Index
2
Experiment No. 1
Software/Hardware used:
After logging into your account, you can enter MATLAB by double-clicking
on the MATLAB shortcut icon (MATLAB 7.8.0) on your Windows desktop:
When you start MATLAB, a special window called the MATLAB desktop
appears. The desktop is a window that contains other windows. The major
tools within or accessible from the desktop are:
• Command Window
• Command History
• Editor Window
• Workspace
• Current Directory
• Help Browser
3
Figure 1.1: Command Window
4
MATLAB is widely used as a computational tool in science and engineering
encompassing the fields of physics, chemistry, math and all engineering
streams. It is used in a range of applications including-
• Control Systems
• Computational Finance
• Computational Biology
6. If any error occurs in the program correct the error and run it again
5
Dynamic System Models: Represent Simple and Complex dynamics
systems, discretize models and reduce model order.
6
Figure 1.4: Control system toolbox (SISO)
Experiment No. 2
Object: Determine transpose inverse values of given matrix.
Software/Hardware used:
Matlab Code:
X = [1 0 2; -1 5 0; 0 3 -9]
Y = inv(X)
transpose(X)
Results:
X =
1 0 2
-1 5 0
0 3 -9
7
Y =
ans =
1 -1 0
0 5 3
2 0 -9
8
Experiment No. 3
Object: Plot the pole-zero configurations in s-plane for the given transfer function
H(s)=(2S2+5S+1)/(S2+3S+5).
Software/Hardware used:
MATLAB Code:
Result:
9
Thus the MATLAB Program to plot the pole zero mapping in s-plane using
MATLAB function is written and the results are successfully obtained.
10
Experiment No. 4
Software/Hardware used:
MATLAB Code:
K=2
G=tf([1 2],[1 0.5 3])
H=feedback(G,K)
H2=G/(1+G*K)
zpk(H2)
Results:
K =
Transfer function:
s + 2
---------------
11
s^2 + 0.5 s + 3
Transfer function:
s + 2
---------------
s^2 + 2.5 s + 7
Transfer function:
s^3 + 2.5 s^2 + 4 s + 6
-----------------------------------
s^4 + 3 s^3 + 11.25 s^2 + 11 s + 21
Zero/pole/gain:
(s+2) (s^2 + 0.5s + 3)
---------------------------------
(s^2 + 0.5s + 3) (s^2 + 2.5s + 7)
>>
12
Experiment No. 5
Object: Plot the unit step response, impulse response of transfer function.
Software/Hardware used:
MATLAB Code:
Result:
13
Experiment No. 6
Object: Plot root locus of given transfer function.
Software/Hardware used:
MATLAB Code:
Result:
14
Experiment No. 7
Object: Plot bode plot of given transfer function and find phase and gain margin
Software/Hardware used:
15
7. For the output see command window\ Figure window
8. Stop the program.
MATLAB Code:
Result:
Transfer function:
8 s^2 + 18 s + 32
-----------------------
s^3 + 6 s^2 + 14 s + 24
>>
16
Experiment No. 8
Software/Hardware used:
MATLAB Code:
s=tf('s')
G=-((2*s+1)/(s^2+3*s+2))
k=0.5
T=feedback(G*k,1)
nyquist(T)
grid on
axis([-2 0 -1 1])
Result:
Transfer function:
17
s
Transfer function:
-2 s - 1
-------------
s^2 + 3 s + 2
k =
0.5000
Transfer function:
-s - 0.5
---------------
s^2 + 2 s + 1.5
>>
Experiment No. 9
Software/Hardware used:
18
5. Compile and Run the program
6. If any error occurs in the program correct the error and run it again
7. For the output see command window\ Figure window
8. Stop the program.
MATLAB Code:
Result:
a =
x1 x2 x3
x1 -0.1495 -0.08632 -0.08842
x2 -0.1032 -0.08211 -0.06947
x3 -0.09474 -0.06316 -0.08421
b =
u1 u2 u3
x1 0.7474 0.4316 0.4421
x2 0.5158 0.4105 0.3474
x3 0.4737 0.3158 0.4211
c =
x1 x2 x3
y1 1 0 0
y2 0 1 0
y3 0 0 1
19
d =
u1 u2 u3
y1 0 0 0
y2 0 0 0
y3 0 0 0
Continuous-time model.
>>
Experiment No. 10
Software/Hardware used:
20
6. If any error occurs in the program correct the error and run it again
7. For the output see command window\ Figure window
8. Stop the program.
MATLAB Code:
Result:
s^2 + 3
#2: -----------
s^2 + s + 1
a =
x1 x2 x3 x4 x5
x1 -3 -1.5 -1 0 0
x2 2 0 0 0 0
x3 0 1 0 0 0
x4 0 0 0 -1 -1
x5 0 0 0 1 0
21
b =
u1
x1 1
x2 0
x3 0
x4 2
x5 0
c =
x1 x2 x3 x4 x5
y1 0 0.5 0.5 0 0
y2 0 0 0 -0.5 1
d =
u1
y1 0
y2 1
Continuous-time model.
State-space model with 2 outputs, 1 inputs, and 5 states.
a =
x1 x2 x3
x1 -1.759 -0.9983 0.3109
x2 -0.2439 -1.281 -1.018
x3 -0.05064 1.077 0.03966
b =
u1
x1 0.2105
x2 2.226
x3 0.03609
22
c =
x1 x2 x3
y1 -0.1494 0.009761 0.2694
y2 0.1787 -0.4801 0.8588
d =
u1
y1 0
y2 1
Continuous-time model.
State-space model with 2 outputs, 1 inputs, and 3 states.
>>
Experiment No. 11
Software/Hardware used:
23
6. If any error occurs in the program correct the error and run it again
7. For the output see command window\ Figure window
8. Stop the program.
MATLAB Code:
s = tf('s');
G = (4/(s+2));
T = feedback(G,(2/s+4));
t = 0:0.1:25;
u = t;
[y,t,x] = lsim(T,u,t);
plot(t,y,'y',t,u,'m')
xlabel('Time (sec)')
ylabel('Amplitude')
title('Input-purple, Output-yellow')
Result:
24
Experiment No. 12
Object: Determine the time response of the given system subjected to any arbitrary
input.
Software/Hardware used:
MATLAB Code:
y = lsim(sys,u,t);
size(y)
Result:
Transfer function:
25
3
-------------
s^2 + 2 s + 3
ans =
201 1
>>
26