The `rlocus` command in MATLAB generates the root locus plot of a transfer function, which helps in analyzing the stability of control systems as feedback gain varies.
s = tf('s');
G = 1/(s^2 + 2*s + 1); % Define transfer function
rlocus(G); % Generate root locus plot
What is the Root Locus Method?
Root locus is a graphical technique used to analyze the trajectory of the poles of a closed-loop control system as a system parameter (typically gain) is varied. It is an essential method in control theory and provides critical insights into system stability and dynamic behavior.
Historical Context
The method originated from the work in control theory during the early parts of the 20th century. Engineers and mathematicians developed it as a practical solution for controlling systems with multiple feedback loops, which has made it invaluable in various industries today.

Importance of Root Locus in Control System Design
Root locus plays a crucial role in the design and analysis of control systems. The method allows engineers to:
- Visualize how the system's poles move in the complex plane with changes in gain.
- Evaluate the stability of the closed-loop system.
- Improve the design of feedback controllers, facilitating the tuning of the system for desired specifications.
By utilizing root locus, engineers can ensure their systems perform as intended in real-world applications, such as aerospace, robotics, automotive, and various other engineering fields.

Understanding the Basics of Root Locus
Key Terminology
To fully grasp root locus, it's essential to understand some fundamental concepts:
-
Poles: These are the values of 's' that make the denominator of a transfer function zero. Poles indicate the system's natural frequencies and play a crucial role in determining the stability and response characteristics of the system.
-
Zeros: These are the values of 's' that make the numerator of a transfer function zero. Zeros can influence the system's response behavior, including improving stability and altering the system's transient response.
Basic Concepts of Stability
A system is defined as stable if its output returns to equilibrium after a disturbance. In control systems, stability typically involves examining the locations of system poles. A basic fundamental is:
-
Stable Systems: For a continuous-time system, stability is assured when all poles of the transfer function are located in the left half of the complex plane.
-
Routh-Hurwitz Criterion: This criterion provides a systematic way to determine the stability of a polynomial equation, eliminating the need to find its roots directly.

Getting Started with MATLAB rlocus
Setting Up the MATLAB Environment
Before using the `rlocus` function, ensure that your MATLAB environment is properly set up:
-
Installation Instructions: If you haven’t already, install MATLAB and ensure that you have the Control System Toolbox. This toolbox is critical for executing control-related commands, including root locus analysis.
-
Toolbox Requirements: Open MATLAB, and you can check whether the toolbox is installed by typing `ver` in the command window. Look for "Control System Toolbox" in the list.
Basic Syntax of rlocus Command
The `rlocus` command in MATLAB allows users to create root locus plots conveniently. Its basic syntax is as follows:
rlocus(G)
Where `G` represents your transfer function or system model.
Example 1: Simple Root Locus Plot
Here's a straightforward example to generate a root locus plot for a simple transfer function:
% Define Transfer Function
s = tf('s');
G = 1/(s^2 + 3*s + 2);
% Generate Root Locus
rlocus(G);
In this code:
- `s = tf('s')` defines the Laplace variable, `s`, for convenience in creating transfer functions.
- `G = 1/(s^2 + 3*s + 2)` specifies the transfer function you want to analyze.
- `rlocus(G)` generates the root locus plot corresponding to `G`.

Analyzing Root Locus Plots
Interpreting the Plots
Root locus plots reveal important information about a system's behavior:
-
Poles and Zeros Representation: Poles are indicated as 'x' marks, while zeros are shown as circles on the complex plane. The movement of poles as gain changes is depicted by the lines connecting these points.
-
Root Locus Path: The path traced by the poles as gain varies illustrates how the dynamics of the system change, providing insight into stability and response characteristics. You can make critical stability assessments based on where these poles land.
Stability and Performance
The location of poles on the complex plane has direct implications on system stability:
-
Effect of Pole Locations: For stability, all poles must lie in the left half-plane. If any pole moves to the right half-plane as gain increases, the system will be unstable.
-
Transient Response: The system's pole configuration closely relates to its transient response, impacting overshoot, settling time, and oscillation behavior. Root locus aids in visualizing this relationship, making it easier to adjust controller parameters accordingly.

Getting Advanced with rlocus
Modifying Root Locus Plots
The `rlocus` function in MATLAB provides several options for customization:
-
Specifying Gain: You can specify a range of gain values to investigate different system responses, enhancing the depth of analysis.
-
Plot Customization: MATLAB allows users to customize their plots. You can adjust titles, axis labels, and colors to improve clarity.
Example 2: Customized Root Locus Plot
Let's illustrate how to create a customized root locus. Here’s an example:
% Define Transfer Function
G = 1/(s^2 + 3*s + 2);
% Generate Customized Root Locus
rlocus(G, 0:0.1:10);
title('Customized Root Locus Plot');
xlabel('Real Axis');
ylabel('Imaginary Axis');
In the above example:
- The command generates a root locus for a specified gain range from 0 to 10.
- The `title`, `xlabel`, and `ylabel` functions enhance the readability of the plot. Custom titles and axis labels help viewers understand the context of the analysis.

Practical Applications of Root Locus in MATLAB
Controller Design
Root locus is vital when designing controllers, especially PID controllers, which are commonplace in automation and control systems:
- PID Controller Design: The root locus method can be used to tune the PID controller parameters to achieve desired performance metrics.
Example: PID Source Code
Here is a MATLAB snippet demonstrating how to use root locus for a PID controller design:
Kp = 10; Ki = 1; Kd = 1;
C = pid(Kp, Ki, Kd);
G = 1/(s^2 + 3*s + 2);
T = C*G/(1 + C*G);
rlocus(T);
In this code:
- `Kp`, `Ki`, and `Kd` are the proportional, integral, and derivative gains of the PID controller.
- `C = pid(Kp, Ki, Kd)` defines the PID controller.
- The closed-loop transfer function `T` is established for analysis, and `rlocus(T)` plots its root locus.
This example shows how you can visualize the impact of different control parameters on system stability and performance.
Real-World Example: Aerospace Application
Root locus is critical in aerospace engineering, where precise control is essential. A case study could involve the design of an autopilot system, which utilizes root locus for pole placement to ensure the aircraft can maintain stability and responsiveness under varying flight conditions.

Troubleshooting and Tips
Common Issues
When working with the `rlocus` function, you might encounter some common problems:
-
Error Messages: Ensure that your transfer function is properly defined. MATLAB will return errors if the transfer function is ambiguous or incorrectly specified.
-
Plot Issues: If the plot does not render as expected, check for typos in your code and confirm that you have defined the transfer function correctly. Also, ensure your MATLAB environment is functioning properly.
Best Practices
To maximize the effectiveness of root locus analysis, consider the following tips:
-
Effective Use of Root Locus: Familiarize yourself with how gain changes influence pole placement to better anticipate system responses.
-
Validation Techniques: After generating the root locus plot, validate your findings using additional stability criteria or simulations. This ensures that your decisions based on the plot align with the system's performance in practice.

Conclusion
The root locus method is an indispensable tool in control system analysis and design, offering invaluable insights into system dynamics. By using MATLAB's `rlocus` command, engineers can visualize the effects of varying gains on system poles, leading to informed decisions that enhance stability and performance in practical applications. With the knowledge of root locus and its implementation in MATLAB, you are well-equipped to design robust control systems that meet specific engineering demands. For further learning, a wealth of resources is available, from specialized books to online courses, enabling deeper exploration into control systems and MATLAB applications.