# Using rlocus() in MATLAB

67 views (last 30 days)
Tb on 27 Jan 2022
Commented: Paul on 28 Jan 2022
Hello,
I am trying to plot the root locus of a closed system, with a simple proportional control, and see how it varies with the controller gain K_C. I have a few questions:
1) From the documentaion on rlocus() im slightly confused by which transfer function needs to be used. I need to get the closed loop root locus, does that mean I use the closed loop transfer function (which I do have)? From my understanding of the documentation I should be using the open loop transfer function, but im not sure why.
2) When I use the open loop transfer function, and vary K_C the poles don't change at all as the poles have no dependancy on the value of K_C (K_C is only multiplied by the numerator of the transfer function, and is not present in the denominator). But when I use the closed loop TF which has a K_C in the denominator I see the poles shift.
Here is the transfer function I am running:
%Smallest possible Kc
Kc = 1;
T_ol_num = [100*Kc];
T_ol_den = [8 16 24 32];
sys_ol = tf(T_ol_num, T_ol_den);
%Larger Kc
Kc2 = 10000;
T_ol_num2 = [100*Kc2];
sys_ol2 = tf(T_ol_num2, T_ol_den);
figure;
hold on
rlocus(sys_ol, 'r', sys_ol2, 'b')
There is no difference in output root locus.

Paul on 28 Jan 2022
Hello @Tb,
The basic idea of the root locus is that is shows the location of the closed loop poles as a function of a gain, let's call it K, where the open loop transfer function is L(s) and the characteristic equation of the closed loop transfer function is 1 + K*L(s). In your case, with simple proportional control with gain Kc, the closed loop transfer function is:
H(s) = Kc*L(s) / (1 + Kc*L(s))
So if you want to see how the closed loop poles migrate as Kc varies, you need to plot the root locus of just L(s) = 100/[8s^3 + 16*s^2 + 24*s + 32).
In your code in the first case, you're plotting the root locus of L1(s) = 100*1*(1/den(s)), which shows the migration of the closed loop poles as some other gain, K1, varies and the closed loop transfer function is H2(s) = K1*L1(s)/(1 + K1*L2(s)). In the second case L2(s) = 100*10000*(1/den(s)), and H2(s) = K2*L2(s) / (1 + K2*L2(s)). Note that L1 and L2 will have identical closed loop poles if K1/K2 = 10000, which is why the root locus plots look the same for both cases.
Similarly, the root locus of L(s) will have the same look as the root locus of L1 and L2. In fact, because L1(s) has Kc = 1, the root locus of L(s) will correspond to the same gain as that for L1(s).
L = tf(100,[8 16 24 32]);
L1 = 1*L; % case 1 with Kc = 1
L2 = 10000*L;
figure
rlocus(L);
figure;
rlocus(L2)
As you pointed out, the root locus is the same for L (and L1) and L2. But the proportional control gain that corresponds to the same closed loop poles will not be the same
r = rlocus(L,1)
r =
-2.9138 + 0.0000i 0.4569 + 2.3354i 0.4569 - 2.3354i
r2 = rlocus(L2,1/10000)
r2 =
-2.9138 + 0.0000i 0.4569 + 2.3354i 0.4569 - 2.3354i
The bottom line is,if you want to see how the closed loop poles vary as a function of Kc, plot the root locus of the loop transfer function L(s), where 1 + Kc*L(s) is the closed loop characteristic equation, and the result will show how the closed loop poles migrate as a function of Kc.
##### 2 CommentsShowHide 1 older comment
Paul on 28 Jan 2022
Basically, yes. Typically the root locus starts with a gain of 0 so it shows how the closed loop poles shift as Kc varies from 0 to inf (or some large number in a practical sense). You can always use the second argument to rlocus() to specify the gain values for which you want the root locus to be plotted, if you want Kc to start at 1 and increase from there, or if you want to explore the effect of negative gain values, which sometimes is necessary.