Root Locus Analysis Using
MATLAB
4 / 25 / 24
09
EE-20-A
Muhammad Raza Madni 210401034
Nafaye Bin Faisal 210401030
Lab # 09
Objectives:
To verify the effect of open-loop poles and zeros upon the shape of the root locus.
To verify the root locus as a tool for estimating the effect of open-loop gain upon the transient
response of closed-loop systems.
To use MATLAB to design the gain of a controller via root locus.
Equipment’s:
Laptop
MATLAB
Introduction to Root Locus:
Root locus is a graphical presentation of the closed loop poles as a system parameter is varied. The root
locus can be used to describe qualitatively the performance of a system as various parameters are changed.
For example, the effect of varying gain upon percent overshot, settling time, and peak time can be vividly
displayed.
In the lab we learnt how to sketch a root locus and how to find exact points of interest e.g. the axis crossing,
the breakaway/break in points, the centroids of asymptotes. Plotting a rough sketch is considerably simple;
however, finding exact points on the root locus requires mathematical calculation. MATLAB makes this task
much easier. The root locus technique is used for stability analysis. Using the root locus, the range of values
of K, for a stable system can be determined. It is also easier to study the relative stability of the system from
the knowledge of location of closed loop poles.
Knowing the locations of the poles and zeros is important because
1. It affects the transient response.
2. It indicates whether the system is stable or not.
3. An important property of the control system is the variation of these locations as the controller gain
changes.
Task
For the given transfer functions, use commands of Rlocus, Rlocfind and Rltool and write down your observations
based on different plots.
Solution:
Note: this is a generic code for first three equations:
% Define the transfer function
numerator = [1];
denominator = conv([1, 1], conv([1, 2], [1, 3]));
sys = tf(numerator, denominator);
% Plot the root locus
figure;
rlocus(sys);
title('Root Locus of the System');
xlabel('Real Part');
ylabel('Imaginary Part');
grid on;
% Wait for user to click on the plot and get the coordinates
disp('Select a point on the root locus by clicking.');
[x, y] = ginput(1);
% Calculate the complex number from the clicked coordinates
selected_point = x + 1i * y;
% Determine the poles and gain at the selected point
[selected_poles, gain] = rlocfind(sys, selected_point);
% Display the poles corresponding to the selected point
fprintf('Poles for gain %.2f:\n', gain);
disp(selected_poles);
% Obtain the root locus breakaway points
root_locus_points = rlocus(sys);
% Display the breakaway points
disp('Root locus breakaway points:');
disp(root_locus_points);
% Check system stability based on poles
is_stable = all(real(selected_poles) < 0);
if is_stable
disp('The system is stable.');
else
disp('The system is unstable.');
end
% Determine if the root locus crosses the imaginary axis
crosses_imag_axis = any(imag(selected_poles) == 0);
if crosses_imag_axis
disp('The root locus crosses the imaginary axis.');
else
disp('The root locus does not cross the imaginary axis.');
end
% Open the root locus design tool for further exploration
rltool(sys);
For:
We can see here that as we get closer to zero the system gets more and more stable.
We can see here that as we go far from the zero the system gets more and more unstable.
For:
For:
For:
% Define the numerator and the complex denominator for the transfer function
numerator = [1];
denominator = conv(conv([1, 0.6, 10], [1, 0.5]), [1, 0]);
sysGH = tf(numerator, denominator);
% Plot the root locus
figure;
rlocus(sysGH);
title('Root Locus of the Transfer Function');
xlabel('Real Axis');
ylabel('Imaginary Axis');
grid on;
% Wait for user input on the plot
disp('Select a point on the root locus by clicking.');
[x, y] = ginput(1);
% Convert to complex number for pole finding
selected_point = x + 1i * y;
% Determine the poles and gain for the selected point
[located_poles, gain] = rlocfind(sysGH, selected_point);
% Display the poles for the chosen gain
fprintf('Poles at gain %.2f:\n', gain);
disp(located_poles);
% Determine the root locus breakaway points
rl_points = rlocus(sysGH);
% Display breakaway points
disp('Root locus breakaway points:');
disp(rl_points);
% Determine stability based on pole locations
if all(real(located_poles) < 0)
disp('The system is stable.');
else
disp('The system is unstable.');
end
% Check whether the imaginary axis is part of the locus
is_imaginary_axis_part_of_locus = any(imag(located_poles) == 0);
if is_imaginary_axis_part_of_locus
disp('The root locus intersects the imaginary axis.');
else
disp('The root locus does not intersect the imaginary axis.');
end
% Open the root locus design tool for further analysis and design
rltool(sysGH);
…the end!