None
In this notebook, your challenge is to expand your tool set for sketching root locus plots to answer a very important question:
DOES the system ever go unstable for a positive root locus gain $K$, and if so, what gain $K$ will make the system go unstable?
The answer to this question improves the usefulness of the root locus for us-- as we design a controller that gives us behavior we like, it is critical to know whether and if we expect our system to go unstable under closed loop control. If we do suspect that our system can go unstable, knowing how close our design is to that stability limit is very valuable.
In the following sections, we will explore how we might answer this question.
To reiterate, we're talking about drawing the root locus of this system:
Which has the closed loop transfer function $G_{cl}(s) = \frac{y(s)}{r(s)}=\frac{KG}{1+KGH}$.
The step we'll cover in this notebook is:
Let's revisit the system we looked at for Monday's assignment:
$$G(s)H(s) =\frac{10}{(s+1)(s+2)(s+3)}$$Our first for steps from this example are reproduced from Monday's assignment below:
Now, we sketch the root locus as being on the real axis wherever we find an odd number of poles and zeros of $G(s)H(s)$ to the right of that portion of the real axis as follows:
Now our job is to find asymptotes, their intersection point, and their angles. We know that the two branches that started at s=-1 and s=-2 can't stay on the real axis forever... there are no zeros, so the number of asymptotes we expect from the plot is
$$a = n-m=3-0$$So we need to find 3 asymptotes. It looks like we've already found 1 of them using step 3... to the left of s=-3, there are always 3 open loop poles to our right, so the root locus is always on the root locus there. But what happens to the two branches that originated at s=-1 and s=-2? They must somehow go to to infinity on the complex plane, and they'll do this by "breaking away" from the real axis somewhere between -2 and -1. The angles of the 3 asymptotes for our system are given by:
$$\theta_a = \frac{2k+1}{n-m}\pi$$Which we evaluate for k=0, 1, and 2. This gives us the following three asymptote angles:
For k = 0, we get: $$\theta_1 = \frac{1}{3}\pi$$
For k=1, we get: $$\theta_2 = \frac{3}{3}\pi$$
And for k=2, we get: $$\theta_3 = \frac{5}{3}\pi$$
These asymptotes all meet at one place on the real axis. This place is found by computing:
$$\sigma_a = \frac{\sum poles -\sum zeros}{n-m} = \frac{(-1)(-2)(-3)}{3} = -2$$So the asymptotes are at $60^\circ$, $180^\circ$ (which we alreaday found using step 3), and $300^\circ$, and they meet at $s=-2$. Let's draw these asymptotes on our root locus sketch:
Now, we know that the locus has to "break away" from the real axis to approach these asymptotes, and that it must do this between s=-1 and s=-2 somewhere. There is a manual method that can be used to accomplish this, but we will not cover it in this course. For getting a general idea of the root locus shape, it is not needed; simply draw the root locus breaking away and/or in to the real axis where appropriate given the information you have from Step 3. Note that the root locus will always enter and leave the real axis perpendicularly.
So this concludes our sketch. Let's use Octave to check our work, as usual.
s = tf('s');
GH = 1/((s+1)*(s+2)*(s+3))
rlocus(GH)
The thing that I asked you to notice on Monday about this system's root locus "eventually going unstable" is the focus of Step 5, which we will cover next.
If the real part of an eigenvalue is positive, it means that the system will have a response whose magnitude increases exponentially, rather than decays exponentially. A system exhibiting this type of behavior is NOT BIBO stable. Therefore, the entire region to the right of the origin is unstable.
.
The root locus plot generated in the code cell above shows that at some value of $K$, the system will go unstable. This is BAD. Especially if you've approximated a $3^{rd}$ order system as a lower-order system, you may find yourself "unintentionally" crossing into unstable territory if you use a very high-gain or "stiff" controller. Let's unpack step 6 just a little by breaking it into two parts:
5a. If you suspect that the root locus crosses into the right half of the s-plane, (based on the asymptote angles)
5b. Find out where and how by calculating the crossing frequency (where the system crosses into unstable territory) and critical gain (gain that makes this happen) using the closed loop characteristic equation.
5a asks us to use our intuition to determine whether the system will ever go unstable. This is easier than it sounds. By plotting asymptotes in Step 4, we can see whether the asymptotes themselves cross into the right half of the s-plane. If they do, then we should suspect that eventually, our system goes unstable. Mathematically, "going unstable" means that at least one of (or more commonly, a complex conjugate pair of) the closed-loop eigenvalues will cross into the right half of the s-plane. We know that for this to happen, the real component of the "crossing" eigenvalue will be 0. This leads us to say that while we don't know exactly where the cross happens, we can write the value of $s$ where the system crosses into the unstable region.
Using the generalized form of a complex number in Cartesian Form to represent an eigenvalue:
$$s = \sigma + j\omega$$The eigenvalue where the root locus cross the imaginary axis ($\sigma = 0$) is
$$s_{crossing}=j\omega_{crossing}$$To solve for where this point is, exactly (in other words, what is $\omega_{crossing}$?), we can do the following:
This will allow us to find both where $s_{crossing}=j\omega_{crossing}$ is located, and the critical gain factor $K_{crit}$ that makes the system go unstable.
Let's keep working with the example above, with:
$$G(s)H(s) =\frac{10}{(s+1)(s+2)(s+3)} = \frac{10}{s^3+6s^2+11s+6}$$Now, we know that we can write our characteristic equation evaluated at the critical gain $K_{crit}$ and crossing point $s_{crossing}=j\omega_{crossing}$ as:
$$1+\left.K_{crossing}G(s)H(s)\right|_{s=j\omega_{crossing}}=0$$Substituting our "open loop transfer function" in, and clearing fractions, we get:
$$s^3+6s^2+11s+6+10K = 0$$Now, substituting $K=K_{crit}$ and $s = j\omega_{crossing}$ into this equation, we get:
$$(j\omega_{crossing})^3+6(j\omega_{crossing})^2+11(j\omega_{crossing})+6 +10K_{crit}=0$$Collecting real and imaginary terms here gives us:
$$j(-\omega_{crossing}^3+11\omega_{crossing})+6(1-\omega_{crossing}^2)+10K_{crit}=0$$We can write the real and imaginary parts of this equation as two separate equations as follows:
Real: $$ 6(1-\omega_{crossing}^2)+10K_{crit}=0$$ Imaginary: $$ j(-\omega_{crossing}^3+11\omega_{crossing})=0$$
Now, we have two equations and two unknowns. We can find $\omega_{crossing}$ from the imaginary part of the equation, since $K_{crit}$ doesn't appear as $\omega_{crossing} = 0,\sqrt{11}$. We know that $\omega_{crossing}=0$ is a point on the real axis that we already know is not part of the root locus, so we throw this solution out to find $\omega_{crossing}=\sqrt{11}$. Then, substituting this back into the real part of our characteristic equation tells us:
$$6(1-11)+10K_{crit}=0$$Which gives us $K_{crit}=6$. Now we know the maximum value of K that will keep our system stable! That's very, very powerful. This is is fairly easy to check using the root locus functionality in Octave, as shown below, where we will plot our crossover point on the root locus plot that octave generates by finding the roots of our characteristic equation at the critical gain we calculated.
s = tf('s');
%set up the open loop TF
GH = 10/((s+1)*(s+2)*(s+3))
%plot the root locus, set hold on
rlocus(GH,.01,0,6)
hold on
%now calculate our eigenvalues at our calculated critical gain so we can see if we were right!
Kcrit = 6;%this is what we calculated by hand
%compute closed loop TF
Gcl = minreal(Kcrit*GH/(1+Kcrit*GH));
%pull out the denominator
[num,den] = tfdata(Gcl,'v');
%find the roots of the characteristic equation
myroots = roots(den);
%plot those roots on our root locus plot
plot(real(myroots),imag(myroots),'c.','MarkerSize',30)%make them huge so we can see them!
As you can see, we were spot on! The system does indeed cross over into the unstable region of the s-plane right when $K=6$. It is worth noting that you can also do this an even easier way using MATLAB by using the "data cursor." You cannot do this in Jupyter, but if you open MATLAB and plot a root locus, you can click on the "data cursor" button to get information about a root locus. An example of this for the system we're discussing is shown below, which also confirms our suspicions about the crossing point and the critical gain.
hint: to get the most precision out of your data cursor in MATLAB, right click, select "selection style," and select "mouse position."
Finally, use the asymptotes to sketch each branch (one per pole of $G(s)H(s)$) of your system's root locus, noting that each pole of the closed loop system will begin at one of the poles of $G(s)H(s)$ and terminate at either a zero of $G(s)H(s)$ or at infinity. Approximate any break-in or break-out points using the real axis rule (step 3).
Sketch the root locus for the following "open loop transfer functions" $G(s)H(s)$ using steps 1 through 5 of the sketching rules. Find the crossing point and critical gain for each system if applicable. Include all hand calculations and your hand-sketch. You may check your work using Octave in the provided code cells.
YOUR ANSWER HERE
% YOUR CODE HERE
error('No Answer Given!')
YOUR ANSWER HERE
% YOUR CODE HERE
error('No Answer Given!')