
Drawing the open-loop root locus
Model reduction
Integral Control
Proportional plus Integral Control
Proportional plus Integral plus Derivative Control
Finding the gain using the rlocfind command and plotting the closed-loop response
From the main problem, the dynamic equations in transfer function form are the following:



and the system schematic looks like:

For the original problem setup and the derivation of the above equations, please refer to the Modeling a DC Motor page.
With a 1 rad/sec step reference, the design criteria are:
Now let's design a controller using the root locus method.
Create a new m-file and type in the following commands (refer to main problem for the details of getting those commands).
J=3.2284E-6; b=3.5077E-6; K=0.0274; R=4; L=2.75E-6; num=K; den=[(J*L) ((J*R)+(L*b)) ((b*R)+K^2) 0]; motor=tf(num,den);
The main idea of root locus design is to find the closed-loop response from the open-loop root locus plot. Then by adding zeros and/or poles to the original plant, the closed-loop response will be modified. Let's first view the root locus for the plant. Add the following commands at the end of your m-file.
rlocus(motor) sgrid(.5,0) sigrid(100)The commands sgrid and sigrid are functions. Sgrid is a function in the control systems tool box, but sigrid is not. You need to copy the sigrid.m file to your directory. Click here to see how to copy sigrid.m into an m-file. The variab in the sgrid command are the zeta term (0.5 corresponds to a overshoot of 16%), and the wn term (no rise time criteria) respectively. The variable in the sigrid command is the sigma term (4/0.04 seconds = 100). Run the above m-file and you should get the root locus plot below:

If you look at the axis scales on this plot, one open-loop pole is
very far to the left (further than -1x10^6). This pole does not
affect the closed loop dynamics unless very large gains are used,
where the system becomes unstable. We will ignore this pole by doing a
model reduction.
Let's see what the poles of the original transfer function are.
Enter the following command at the MATLAB prompt:
Now we can draw the root locus of the reduced system. Add the following
commands to the end of your m-file and re-run it.
We can see from this plot that the closed-loop poles are never fast
enough to meet the settling time requirement (that is, they never move
to the left of the sigma=100 vertical line). Also, recall that we
need an integrator in the controller (not just in the system) to remove
steady-state error due to a disturbance.
From this root locus we can see that the closed-loop system under
integral control is never stable, and another controller must be used.
Model Reduction
If you have a transfer function which has one (or more) poles to the
far left of the dominant poles, you can neglect these poles and the
closed-loop
response for small gains will not be affected (for large gains, these
poles will push the root locus to the right-half plane, causing
instability). The correct way to neglect these poles, keeping the
DC gain of the transfer function constant, is as follows:

roots(den)
You should see the following output:
We want to neglect the pole at -1.45e6. This can be translated into
MATLAB code as:
ans =
1.0e+06 *
0
-1.4545
-0.0001
J=3.2284E-6;
b=3.5077E-6;
K=0.0274;
R=4;
L=2.75E-6;
num=K;
den=[(J*L) ((J*R)+(L*b)) ((b*R)+K^2) 0];
poles=roots(den);
den2=deconv(den,[1/max(abs(poles)) 1]);
motor=tf(num,den2);
You can now check that the other poles have not been affected by entering
roots(den2)
at the MATLAB prompt.
rlocus(motor)
sgrid(.5,0)
sigrid(100)
You should obtain the following plot in which you can see that the
closed-loop system will be stable for small gains.
Integral Control
Now, let's try using integral control to remove steady-state error to
a disturbance. Modify your m-file so it looks like:
J=3.2284E-6;
b=3.5077E-6;
K=0.0274;
R=4;
L=2.75E-6;
num=K;
den=[(J*L) ((J*R)+(L*b)) ((b*R)+K^2) 0];
poles=roots(den);
den2=deconv(den,[1/max(abs(poles)) 1]);
motor=tf(num,den2);
contr=tf(1,[1 0]);
rlocus(contr*motor)
sgrid(.5,0)
sigrid(100)
Note that this adds a 1/s term to the forward loop.
Run this m-file and you will obtain the
following plot.
Proportional plus Integral Control
Now, let's modify the integral controller to a PI controller. Using
PI instead of I control adds a zero to the open-loop system. We'll
place this zero at s=-20. The zero must lie between the open-loop
poles of the system in this case so that the closed-loop will be
stable. Change the lines defining the controller (numcf and dencf) in
your m-file to the following.
contr=tf([1 20],[1 0]);
Re-run your m-file and obtain the following plot.
Note: You may not get a similar plot in your MATLAB window, depending
on which version of the rlocus command you are
using. If the MATLAB output
does not satisfy the rules of the root locus,
or does not
match your expectations, you can always specify which gains you
would like MATLAB to plot. For this particular root locus, the
following commands (replacing the rlocus
command above) work well.
gain = 0:0.1:20;
rlocus(contr*motor,gain)
Now, we have managed to stabilize the system with zero steady-state
error to a disturbance, but the system will still not be fast enough.
numc=conv([1 60],[1 70]); denc=[1 0]; contr=tf(numc,denc);Re-run your m-file and obtain the following plot.

Now, we can see that two of the closed-loop poles loop around well within both the settling time and percent overshoot requirements. The third closed loop pole moves from the open-loop pole at s=-59.2 to the open loop zero at s=-60. This closed-loop pole nearly cancels with the zero (which remains in the closed loop transfer function) because it is so close. Therefore, we can ignore its effect. However, the other open-loop zero also remains in the closed-loop, and will affect the response, slowing it down, and adding overshoot. Therefore, we have to be conservative in picking where on the root locus we want the closed-loop poles to lie.
If you recall, we need the settling time and the overshoot to be as small as possible, particularly because of the effect of the extra zero. Large damping corresponds to points on the root locus near the real axis. A fast response corresponds to points on the root locus far to the left of the imaginary axis. To find the gain corresponding to a point on the root locus, we can use the rlocfind command. We can find the gain and plot the step response using this gain all at once. To do this, enter the following commands at the end of your m-file and rerun it.
[k,poles] = rlocfind(contr*motor) sys_cl=feedback(k*contr*motor,1); t=0:0.001:.1; step(sys_cl,t)Go to the plot and select a point on the root locus on left side of the loop, close to the real axis as shown below with the small + marks. This will ensure that the response will be as fast as possible with as little overshoot as possible. These pole locations would indicate that the response would have almost no overshoot, but you must remember that the zero will add some overshoot.

After doing this, you should see the following output in the MATLAB command window.
selected_point = -1.3943e+02+ 1.8502e+01i k = 0.1309 poles = 1.0e+06 * -1.4542 -0.0001 + 0.0000i -0.0001 - 0.0000i -0.0001Note that the values returned in your MATLAB command window may not be exactly the same, but should at least have the same order of magnitude. You should also get the following step response plot:

As you can see, the system has an overshoot of approximately 15%, a settling time of approximately 0.04 seconds, and no steady-state error.
Let's now look at the disturbance response by computing the closed-loop disturbance transfer function and plotting its step response. Add the following lines to your m-file:
dist_cl=feedback(motor,k*contr); step(dist_cl,t)Re-run your m-file, selecting the same point on the root locus, and you will get the following plot.

You can see that the response to a step disturbance reaches a steady-state value of zero, and in fact, stays within 0.02 (or 2%) after 0.04 seconds. Therefore, all the design requirements have been met.
In this example, we placed zeros on the root locus to shape it the way we wanted. While some trial-and error is necessary to place the zeros, it is helpful to understand how the root locus is drawn, and MATLAB is used to verify and refine the placement.
