SW1 03
SW1 03
Experiment no: 01
Experiment Name: Analysis of Open Loop and Closed Loop Control Systems
and Effect of Gain on Stability of the System via Root Locus
Group members:
Sl. Name ID
1. SHAFIN AHMED 22121029
2. MEHEDI HASSAN 22121074
3. ABU TALHA 22121105
Requirements:
● Working Pc
● MATLAB with Simulink.
Theoretical Background:
An open-loop control system is a control system in which the control action is totally
independent of the output of the system. A manual control system is also an open-loop control
system.
The control system in which the output affects the input quantity in such a manner that the input
quantity will adjust itself based on the output generated is called a closed-loop control system.
An open-loop control system can be converted into a closed-loop control system by providing
feedback. This feedback automatically makes suitable changes in the output due to external
disturbance.
There are three classes of controllers available – proportional, derivative, and integral.
Combining them, proportional-integral controller, proportional-derivative controller, and
proportional-integral-derivative controller can also be made. The transfer function of the
controllers is:
(𝐾𝑝 + 𝐾𝑖/𝑠 + 𝐾𝑑 * 𝑠) where Kp = proportional gain, Ki = integral gain and Kd = derivative gain.
1 a) Plot the step response of the system 𝐺(𝑠) = 25/(𝑠2 + 11𝑠 + 25) in the same plot if
proportional controller of Kp=5,10,50 and 100 are used and make a table containing the
settling time, overshoot and steady state error. Show the step response using Simulink for
any one of the Kp values.
Matlab Code:
close all;
clear all;
clc;
figure;
hold on;
for kp = kp_values
G1 = feedback(kp*G, 1)
step(G1,0:0.1:5);
disp(['For Kp = ', num2str(kp)]);
stepinfo(G1)
e_ss = 1 - dcgain(G1); % Steady-state error using final value theorem
fprintf('Steady-state = %f\n', e_ss);
end
hold off;
Output :
Output Graph:
Data Table:
Kp Settling time Overshoot Steady
State Error
5 0.6816 20.6097 0.16667
Simulink:
Response Graph:
1 b) Plot the step response of the system 𝐺(𝑠) = 25/(𝑠2 + 11𝑠 + 25) in the same plot if
proportional integral controller of Kp=5 and Ki=5,10,20 and 50 are used and make a table
containing the settling time, overshoot and steady state error. Show the step response using
Simulink for any one of the Kp and Ki combinations.
Matlab Code
close all;
clear all;
clc;
figure;
hold on;
for ki = ki_values
G1 = feedback((kp+ki/s)*G, 1, -1)
step(G1,0:0.1:5);
disp(['For Ki = ', num2str(ki)]);
stepinfo(G1)
e_ss = 1 - dcgain(G1); % Steady-state error using final value theorem
fprintf('Steady-state = %f\n', e_ss);
end
hold off;
Output :
Output Graph:
Data Table:
Ki Settling time Overshoot Steady
State Error
5 2.0267 10.7209 0
10 0.7676 20.3862 0
20 1.0170 37.5154 0
50 4.4038 75.4982 0
Simulink:
Here Kp = 5, Ki = 50.
Response Graph:
1 c) Plot the step response of the system 𝐺(𝑠) = 25/(𝑠2 + 11𝑠 + 25) in the same plot if
proportional derivative controller of Kp=5 and Kd=0.5,1,2 and 3 are used and make a table
containing the settling time, overshoot and steady state error. Show the step response using
Simulink for any one of the Kp and Kd combinations
Matlab Code:
close all;
clear all;
clc;
figure;
hold on;
for kd = kd_values
G1 = feedback((kp+kd*s)*G, 1, -1)
step(G1,0:0.1:5);
disp(['For Kd = ', num2str(kd)]);
stepinfo(G1)
e_ss = 1 - dcgain(G1); % Steady-state error using final value theorem
fprintf('Steady-state error = %f\n', e_ss);
end
hold off;
Output:
Output Graph:
Data Table:
Kd Settling time Overshoot Steady
State Error
0.5 0.1946 0.9129 0.1667
1 0.1940 0 0.1667
Response Graph:
1 d)Determine the Kp, Kd and Ki required to design the best control system in terms of
both steady state and transient performance and plot the step response using the PID
controller. Use Simulink to obtain the values of Kp, Kd and Ki fulfilling following criteriai.
● Rise time- 0.4-0.5 sec
● Settling time is less than 0.8 sec
● Maximum overshoot 5%
Simulink:
Updated Graph:
Desired value of
● Kp = 2.2953
● Ki = 5.5446
● Kd = 0.21303
The system has a rise time of 0.4032 seconds, the system responds promptly to input changes,
falling within the desired range of 0.4-0.5 seconds. The settling time of 0.6656 seconds is
notably shorter than the 0.8-second requirement, indicating that the system stabilizes quickly
after disturbances. The overshoot is very low at 0.3330%, well within the maximum allowable
5%, which demonstrates excellent control with minimal deviation from the desired final value.
The output settles between 0.9010 and 1.0033, showing that the response is well-contained with
only minor fluctuations around the final value. The peak time of 1.1661 seconds highlights
effective control without excessive oscillation. Overall, this design achieves a strong balance
between transient and steady-state performance, delivering a responsive, stable, and precise
control system.
2) Consider the following system: 𝐺(𝑠)=𝐾 * [(𝑠 − 3)(𝑠 − 5)/(𝑠 + 1)(𝑠 + 2)]
Find the range or value of gain K that makes the system:
a. Overdamped
b. Critically Damped
c. Under Damped
d. Marginally Stable
e. Unstable
Matlab Code:
close all;
clear all;
clc;
figure;
rlocus(G);
[k,poles] = rlocfind(G);
figure;
G1 = feedback(k*G,1);
step(G1,0:0.1:10);
stepinfo(G1)
Output Figure 1:
Discussion:
In our control system analysis, we encountered some notable differences between the MATLAB
code results and the Simulink simulations. For the PI controller with Kp=5 and Ki=50, the
Simulink results showed a rise time of 0.1033 seconds, a settling time of 4.3488 seconds, and an
overshoot of 75.0848%. These results were quite different from what the MATLAB code
predicted. The discrepancies likely stem from differences in numerical methods, solver settings,
and simulation precision between the two platforms.
Similarly, for the PD controller with Kp=5 and Kd=1, Simulink results indicated a rise time of
0.4945 seconds, a settling time of 0.9051 seconds, and a minimal overshoot of 0.0528%.
Although these results were generally in line with expectations, small differences from the
MATLAB code suggest that variations in numerical precision and solver configurations can
impact the outcomes.
In our root locus analysis, we identified that the system was critically damped at K=0.0086,
overdamped for K<0.0086, and underdamped for K>0.0086. The system became unstable for
K>0.3740 and undamped at K=0.3740. Pinpointing the exact gain K was tricky, as even minor
errors could lead to instability.
These variations highlight the importance of carefully tuning simulation parameters and
recognizing the differences between theoretical models and practical simulations. While the root
locus method helped understand system stability, the differences between MATLAB and
Simulink emphasize the need for accurate setup and validation to achieve reliable control system
performance.