At this point, we have graphed the poles and zeros for a system's closed-loop transfer function to visualize its stability. However, we can actually look deeper into this response by using root locus. Root locus is another way to visualize the stability of our system by isolating the system controller's PID coefficients and determining how each coefficient affects the stability of the system. The way we visualize root locus is by isolating the desired term in the denominator of our closed-loop transfer function.
Let's say for example, we had a closed-loop transfer function as so
$$ G_{cl}(s) = \frac{\frac{\frac{K_i}{s}+K_p}{s+1}}{1 + \frac{\frac{K_i}{s}+K_p}{s+1}} $$
Where the plant is $ P(s) = \frac{1}{s+1} $ and the PI controller is $ C(s) = \frac{K_i}{s}+K_i $ in unity feedback mode. Then what we can do is multiply by $ (s+1) $ to get
$$ G_{cl}(s) = \frac{\frac{K_i}{s}+K_p}{(s+1) + \frac{K_i}{s}+K_p} $$
Now we can multiply by s to get
$$ G_{cl}(s) = \frac{K_i+s K_p}{s(s+1) + K_i + s K_p} $$
The reason we did this is so our transfer function is ready to isolate the desired PI coefficient. Let's say the desired PI coefficient is $ K_i $. Then what we would do is focus on the denominator. In the denominator, we have $ s(s+1) + K_i + s K_p $, or $ s^2 + s(1+K_p) + K_i $ if we simplify. Now we want to get the form of $ 1 + L(s) K_i $ in the denominator because we chose $ K_i $ to isolate. We can do this by dividing by $ s^2 + s(1+K_p) $. That then gives a closed-loop transfer function of
$$ G_{cl}(s) = \frac{\frac{K_i+s K_p}{s^2 + s(1+K_p)}}{1 + K_i \frac{1}{s^2 + s(1+K_p)}} $$
Hence, $ L(s) = \frac{1}{s^2 + s(1+K_p)} $; now we have a transfer function that shows how $ K_i $ affects the stability of the closed-loop transfer function! Now, before we move on, when we put our transfer function in root locus form, all other PID coefficients, other than our targeted PID coefficient, still in $ L(s) $ are set equal to 1. So, $ L(s) $ would actually be
$$ L(s) = \frac{1}{s^2 + 2s} $$
Now we can move on to visualization!
Now there are several ways to visualize this root locus. The first way is via MATLAB. In MATLAB, there is a function called rlocus(), where the input is a transfer function, and it outputs the root locus plot on a real-imaginary graph. In order to do this, let's start out by writing $ L(s) $ as a transfer function in MATLAB
matlab
% define L(s) as a TF
Numerator = [ 1 ];
Denominator = [ 1, 2, 0 ];
L = tf( Numerator, Denominator );
We now have $ L(s) $ written as a transfer function in MATLAB using the tf() function. Notice the input to tf() is the numerator's coefficients and the denominator's coefficients. Now that $ L(s) $ has been defined, we can use rlocus() to visualize the graph.
matlab
% from before
Numerator = [ 1 ];
Denominator = [ 1, 2, 0 ];
L = tf( Numerator, Denominator );
% use rlocus()
rlocus(L);
And the output from the code above is a graph of the root locus.
Fig. 1 - Plot of root locus for $ L(s) $.
So what MATLAB is doing here, is it's running through the values of $ K_i $ going from zero to $ \infty $, and is plotting all of the zeros and poles. Now, for this example's $ L(s) $, we did not have any zeros, but we had two poles (this is because the denominator was a second order polynomial). MATLAB even shows us the paths of each pole, that is why there are two slightly different colored lines.
Next we will learn some of the tips and tricks for plotting root locus by hand! Here are the rules/recommendations to keep in mind.
Now we have a better understanding of what root locus are, why they are important, and how they can be graphed using MATLAB, and by hand!