Control System Engineering: Lab Manual
Control System Engineering: Lab Manual
Lab Manual
Class________________________________________
Section ______________________________________
Introduction:
MATLAB, an abbreviation of MATrix LABoratory, is an interactive program for numerical computation
and data visualization; it is used extensively by control engineers for analysis and design. There are many
different toolboxes available which extend the basic functions of MATLAB into different application
areas; in these tutorials, we will make extensive use of the Control Systems Toolbox. MATLAB is
supported on Unix, Macintosh, and Windows environments.
MATLAB, its Toolboxes and SIMULINK have become, over a number of years, the industry standard
software package for control system design. The purpose of this LAB is to introduce the students to some
of the more useful aspects of MATLAB, and to illustrate how the software may be used to solve problem
in control system design.
Plot
It is also easy to create plots in MATLAB. Suppose you wanted to plot a sine and cosine wave as a
function of time. First make a time vector (the semicolon after each statement tells MATLAB we don't
want to see all the values) and then compute the sine and cosine value at each time.
t = 0:0.25:10;
y = sin(t);
W=cos(t)
plot(t,y,'.ko','LineWidth',2,'MarkerEdgeColor','k','MarkerFaceColor','k','Mar
kerSize',3)
hold on
plot(t,W,'b*','LineWidth',1.5,'MarkerEdgeColor','k','MarkerFaceColor','k','Ma
rkerSize',3);
plot(t,W)
grid on
xlabel('Time','fontweight','bold','fontsize',9)
ylabel('Amplitude','fontweight','bold','fontsize',9)
title('Sine and Cosine Waves','fontweight','bold','fontsize',10)
legend('Sine wave','Cosine Wave',1)
Transfer Function
This part introduces the reader to time domain analysis using MATLAB. It uses commands from the
Control System Toolbox. A list of the commands can be found using
>> help control
>> help step
Following are some examples how to represent transfer function in MATLAB.
Example 1: Consider a first-order transfer function G(s) = 1/(s+1). The impulse response and step
response function can be created by using following commands in script file.
figure
t = 0:0.01:10;
u = sin(t);
y=lsim(sys,u,t)% Sinusoidal response
plot(t,y)
xlabel('Time','fontweight','bold','fontsize',9)
ylabel('Amplitude','fontweight','bold','fontsize',9)
title('Sine Response for system
G(s)=1/(s+1)','fontweight','bold','fontsize',10)
legend('Step Response',1)
grid on;
Method 3: use “s=tf('s')”
s=tf('s')
sys=1/(s+1)
subplot(2,1,1) %% for description type help subplot
impulse(sys)
grid on
subplot(2,1,2)
step(sys)
grid on
SIMULINK
The Simulink give us easy Model analysis and construction. SIMULINK allows a block diagram
representation of a control system to be constructed and real-time simulation performed.
For data synchronization also export Output as structure from Simulink to MATLAB workspace.
Task: Following are the two transfer functions. Plot the step and impulse response and label properly in
script as well as in Simulink.
1. (s+1)/(s2+2s+1) 2. 10/(s+1)(s+3)(s+5)
In your report label each graph properly as in examples. Also insert caption with each figure. Most
importantly write your observations after each sub-task.
Important Note:
1. If student will copy the lab report, all the identical copy holders will get zero marks.
2. In all subsequent lab reports same lab report style should be used.
Lab:02 Mathematical modeling of electrical and
mechanical systems using MATLAB/Simulink
Objective:
Every day we deal with different physical systems. Interesting fact is that motion or working of these
systems can be modeled mathematically and their behavior can be observed using software’s like Matlab.
This feature helps us in the design of a system. Once the system dynamic mathematical model is
developed, we can transform it into frequency or time domain representation to further analyze the system
performance. In this lab students should be able to mathematically model and simulate the system using
Matlab/Simulnk environment.
Introduction:
A basic RLC circuit is shown is the Figure.1. The system has a voltage source and voltage drops across
each element in the network as shown.
Its dynamic time domain model on terms of differential equations after following the KVL is
𝑑𝑖(𝑡) 1
𝐿 + ∫ 𝑖(𝑡)𝑑𝑡 + 𝑖(𝑡)𝑅 = 𝑣(𝑡) (1)
𝑑𝑡 𝐶
This is the cause of conversation of energy. As the sum of all voltage drops across each component is
equal to the total applied voltage. There is one resistive and two reactive components in the network. The
circuit is a simple series circuit where it has the same current in the network.
In an identical manner a translational mechanical system is given in Figure 3 can be model as (2).
This system could also be modeled in the identical manner using Matlab/Simulink. The choice of the
output is upto the student for the given input.
Student Task: Use the Matlab/Simulink environment to model and simulate the 3DOF system shown in
Figure 4. Take the step response and discuss the results. Provide the complete and solid analysis on the
system response. Lab report should be presented under the instructions provided in the earlier lab.
Introduction:
In this lab Electrical and mechanical system will be modeled in the frequency
domain. First a simple rectilinear plant will be modeled. The system has three
masses m1 , m2 and m3 . These masses are connected to each other and to the rigid
body by the help of springs ( k1 , k2 , k3 , k4 ) and dampers ( c1 , c2 , c3 , c4 ). The applied
external force is F(t). The output can be observed at any point in the network which
is undergoing a change.
The time domain equations of motion for the three DOF rectilinear plant are
Where 𝑁𝑖 (𝑠) and 𝐷(𝑠) are the numerator and denominator for the system.
Student should be able to apply the Laplace transform on the equation 1-3 and solve the equations for the
unknown variables 𝑥1 (𝑠), 𝑥2 (𝑠) and 𝑥3 (𝑠) for the given input F(s). Student should use the Matlab
commands to find the system transfer function. The command ‘tf(numerator, denominator)’ will help to
find the system transfer function.
Electrical System
A three degree of freedom system is shown in Figure 2. The system is identical to the one provided in the
earlier lab. Student has to convert the given set of equation (3-5) in the frequency domain using Laplace
transformation. Student is free to decide the system output for the given input. Use the Matlab command
to find the system transfer function.
Introduction:
The DC motor have two set of equations. One represents the electrical network and the other assumes the
mechanical side of the DC motor.
and the mechanical side mathematical equation for the same system is
Tm ( s) J m s 2 Dm s m ( s) (2)
The final transfer function between motor speed and applied input after substitution of different available
equations becomes (Section 2.8 in textbook)
Kt
m ( s) Ra J m
(3)
Ea ( s) Kt Kb
s 1 J Dm
m Ra
Student Task: Find the system transfer function using the Matlab commands. Student should perform
the analysis by changing the values of system variables. Student should be able to discuss the system
response after changing the variable and the results should be presented in a detailed way.