Experiment No. 2 Control System Simulation Using MATLAB and SIMULINK
Experiment No. 2 Control System Simulation Using MATLAB and SIMULINK
Experiment No. 2 Control System Simulation Using MATLAB and SIMULINK
2
Control system simulation using MATLAB and SIMULINK
Objectives:
1. Write a MATLAB code for finding the time domain specifications of the second order
system from its unit step response. The transfer function of the system is given below,
2
𝐺 (𝑠) =
𝑠 2 + 1.5𝑠 + 2
˙
2. Simulate the following system and plot 𝑥𝑣𝑠𝑥 graphs:
¨ ˙
a) 𝑥 + 0.5𝑥 + 2𝑥 = 0
¨ ˙
b) 𝑥 + 0.5𝑥 + 2𝑥 + 𝑥2 = 0
3. The open loop transfer function of the plant is
6
𝐺 (𝑠) =
(𝑠 + 1)(𝑠 + 2)(𝑠 + 3)
Using the MATLAB code find the values of critical gain and the corresponding period
of the oscillation. Design a P, PI, and, PID controller for the given system (use Root
Locus Technique). Find the step response of the system.
num=[2];
sys=tf(num,den)
step(sys)
stepinfo(sys)
sys = 2
---------------
s^2 + 1.5 s + 2
ans =
RiseTime: 1.2020
TransientTime: 4.0869
SettlingTime: 4.0869
SettlingMin: 0.9238
SettlingMax: 1.1401
Overshoot: 14.0072
Undershoot: 0
Peak: 1.1401
PeakTime: 2.6403
2. Plots:
3. Discussions:
In this lab, we investigated the time domain characteristics of a second-order system using its
unit step response and MATLAB simulations.
• Rise Time:- It is the time required for the response to rise from 0% to 100% of its final
value.
• Peak Time:- It is the time required for the response to reach the peak value for the first
time.
• Peak Overshoot:- Peak overshoot Mp is defined as the deviation of the response at peak
time from the final value of the response. It is also called the maximum overshoot.
• Settling Time:- It is the time required for the response to reach the steady state and stay
within the specified tolerance bands around the final value.
Objective 2
1. Simulink Model :
2. Plots (For unit step input) :
3. Discussions:
In this lab experiment, we conducted a simulation to analyze the behavior of a second-order
dynamic system governed by the differential equation (x)'' + 0.5 (x)' + 2 x = 0 and (x)'' + 0.5
(x)' + 2 x + x*x = 0 for unit step response. The primary objective was to gain insights into the
response of the system and to plot the x vs. (x)' graphs using Simulink.
Objective 3
1. MATLAB code:
a. clc
num=[6];
den=[1 6 11 6];
sys=tf(num,den)
rlocus(sys)
sys =
----------------------
s^3 + 6 s^2 + 11 s + 6
Kp= 10;
Pcr=1.9;
b. Without controller
clc
num=[6];
den=[1 6 11 12];
sys=tf(num,den)
figure,
step(sys)
c. With P controller
clc
syms kp ki kd
kp=5;
ki=0;
kd=0;
sys=tf(num,den)
figure,
step(sys)
d. With PI controller
Ti=(1/1.2)*Pcr=1.583
Ki=Kp/Ti=5/1.583=3.158
clc
syms kp ki kd
kp=5;
ki=3.158;
kd=0;
sys=tf(num,den)
figure,
step(sys)
syms kp ki kd
kp=5;
ki=3.158;
kd=1.1875;
sys=tf(num,den)
figure,
step(sys)
2. Discussions:
In this assignment, we have analyzed Ziegler-Nichols Method of implementing PID
controller.