SESSION: (2022-23)
PRACTICAL FILE
ON
SUBMITTED TO:- SUBMITTED BY:-
Mr. Ritesh Baranwal Aviral Chaurasia
Mr. Praveen Kumar Singh Branch: - (E.C.E)
3rd Year, 6th Sem
Roll No: 195209
1
CONTENTS
EXP. NO NAME OF EXPERIMENT DATE PAGE NO
01 Introduction to MATLAB
02 To determine Transpose Inverse of
given matrix
03 Plot Pole-Zero of given Transfer
Function
04 Transfer Function of Closed loop
System
05 Plot Unit step response, impulse
response of transfer function
06 Plot Root Locus of Given Transfer
Function
07 Plot Bode Plot of given transfer
function and find GM & PM
08 Plot Nyquist Plot of given transfer
function
2
INTRODUCTION TO MATLAB
(CONTROL SYSTEM LAB)
Experiment No. 1
Object: Introduction to MATLAB & to study Control System Toolbox
Software/Hardware used:
● MATLAB 7.8 R2009a
● Personal Computer (32/62 bits)
Introduction to MATLAB: MATLAB (matrix laboratory) is a fourth-generation
high-level programming language and interactive environment for
numerical computation. visualization and programming.
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
3
Help Browser
Figure 1.1: Command Window
4
Figure 1.2: Editor Window
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-
Signal Processing and Communications
Image and Video Processing
Control Systems
Test and Measurement
Computational Finance
Computational Biology
Steps to MATLAB program: 1. Start the MATLAB program.
2. Open new M-file
5
3. Type the program
4. Save in current directory
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.
Control system Toolbox: Control System Toolbox is a package for Matlab
consisting of tools specifically developed for control applications. The
package offers data structure to describe common system representation
such as space state models and transfer functions as well as tools for
analysis and design of control systems.
Dynamic System Models: Represent Simple and Complex dynamics
systems, discretize models and reduce model order.
6
Figure 1.3: LTI Viewer
Figure 1.4: Control System Toolbox
7
Experiment No. 2
Object: Determine transpose inverse values of given matrix.
Software/Hardware used:
● MATLAB 7.8 R2009a
● Personal Computer
Steps to MATLAB Program:
1. Start the MATLAB program.
2. Open new M-file
3. Type the program
4. Save in current directory
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:
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
8
Y =
0.8824 -0.1176 0.1961
0.1765 0.1765 0.0392
0.0588 0.0588 -0.0980
ans =
1 -1 0
0 5 3
2 0 -9
9
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 7.8 R2009a
● Personal Computer
Steps to MATLAB Program:
1. Start the MATLAB program.
2. Open new M-file
3. Type the program
4. Save in current directory
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:
H = tf([2 5 1],[1 3 5]);
pzmap(H)
grid on
Result:
10
Thus the MATLAB Program to plot the pole zero mapping in s-plane using
MATLAB function is written and the results are successfully obtained.
11
Experiment No. 4
Object: Determine the transfer function for closed loop system.
Software/Hardware used:
● MATLAB 7.8 R2009a
● Personal Computer
Steps to MATLAB Program:
1. Start the MATLAB program.
2. Open new M-file
3. Type the program
4. Save in current directory
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:
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:
12
s + 2
---------------
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)
>>
13
Experiment No. 5
Object: Plot the unit step response, impulse response of transfer function.
Software/Hardware used:
● MATLAB 7.8 R2009a
● Personal Computer
Steps to MATLAB Program:
1. Start the MATLAB program.
2. Open new M-file
3. Type the program
4. Save in current directory
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:
H= tf([8 18 32], [1 6 14 24])
subplot (2,1,1)
step(H)
hold on
subplot (2,1,2)
impulse(H)
clf
t=0:0.01:4;
u=sin(10*t);
lsim(H,u,t)
14
Result:
Experiment No. 6
Object: Plot root locus of given transfer function.
Software/Hardware used:
● MATLAB 7.8 R2009a
● Personal Computer
Steps to MATLAB Program:
1. Start the MATLAB program.
2. Open new M-file
3. Type the program
4. Save in current directory
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:
H=tf ([3 5 7],[1 2 2.5 4])
rlocus(H)
grid on
Result:
15
Experiment No. 7
Object: Plot bode plot of given transfer function and find phase and gain margin
Software/Hardware used:
● MATLAB 7.8 R2009a
● Personal Computer
Steps to MATLAB Program:
1. Start the MATLAB program.
2. Open new M-file
3. Type the program
4. Save in current directory
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:
H=tf([8 18 32],[1 6 14 24])
bode(H)
grid on%%%%%%%%%%%%%%
Result:
Transfer function:
8 s^2 + 18 s + 32
-----------------------
s^3 + 6 s^2 + 14 s + 24
>>
16
Experiment No. 8
Object: Plot Nyquist plot of given transfer function.
Software/Hardware used:
● MATLAB 7.8 R2009a
● Personal Computer
Steps to MATLAB Program:
1. Start the MATLAB program.
2. Open new M-file
3. Type the program
4. Save in current directory
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:
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
>>
18
Experiment No. 9
Object:
Software/Hardware used:
● MATLAB 7.8 R2009a
● Personal Computer
Steps to MATLAB Program:
1. Start the MATLAB program.
2. Open new M-file
3. Type the program
4. Save in current directory
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:
19