Stability margins
Our ultimate goal is to design feedback controllers that improve the performance of a system. We already saw one way to do this: the root locus. We start with open-loop poles and zeros, and the root locus shows how the closed-loop poles move as we increase the proportional gain. Ultimately, we want poles in the left half-plane (for stability), and we want to control where precisely they end up (for performance).
We would like to develop an analogous tool for frequency-domain design. So far, we have only seen how to describe a system based on its frequency response and to visualize it using Bode plots. To see what happens when we use feedback, we will start by addressing the question of stability, and then we will move on to performance.
Determine stability from a Bode plot?¶
If our Bode plot comes from experimental data, then our system must be stable. However, unstable systems can still have theoretical Bode plots, namely, we can still compute and plot . For example, consider the unstable system . We can compute its frequency response as follows:
Therefore, and . This looks very similar to the frequency response of . In fact, several different permutations of this system have the same magnitude plot but different phase plots:
Figure 1:Bode plots of several different first-order systems, all with the same magnitude plot but different phase plots.
So we cannot assess stability from the magnitude plot alone. The phase plots aren’t all the same, but they all look pretty similar. There is no obvious way to determine stability just by looking at the Bode plot.
It gets worse: if we add an unstable pole-zero pair that almost cancel each other out, they will have little effect on the Bode plot, but they will make the system unstable! For example, consider the system
where is a small positive number. This system has an unstable pole at that is almost canceled by a RHP zero at . So the system is unstable. Its (theoretical) frequency response is:
So as the frequency response of our unstable and its corresponding Bode plot look indistinguishable from , which is stable!
Closing the loop¶
Although we cannot determine stability of a system from its Bode plot, if we know that our system is stable to begin with, then we can determine how close we are to instability when we close the loop with feedback. Let’s see how this works with simple example. Suppose our open-loop system has the following transfer function:
This system is marginally stable. Now suppose we close the loop with proportional feedback , as shown in the block diagram below:
Figure 2:Standard feedback interconnection of a system with a proportional controller .
Since the system has three poles and no zeros, the root locus plot will have three asymptotes and will have unstable closed-loop poles for sufficiently large . We can confirm this by sketching the root locus plot:
The critical moment where we transition into instability occurs when the root locus crosses the imaginary axis. Let’s investigate what happens with the baseline controller . The characteristic equation of the closed-loop system is: . If we are right on the boundary of stability, then this equation will have a solution on the imaginary axis, so there is some for which . So there should exist a frequency such that (0 dB) and . In other words, there should be some for which the Bode plot satisfies:
What typically happens is that we will not be exactly on the boundary of stability, so the two conditions in Eq. (5) are not satisfied at the same frequency. Define:
Gain crossover frequency () as the frequency where dB, and
Phase crossover frequency () as the frequency where .
If , then we are on the boundary of stability. We illustrate these concepts on the Bode plot of defined in Eq. (4):
Figure 4:Bode plot for defined in Eq. Figure 4, with crossover frequencies and stability margins indicated.
Although we are not exactly on the boundary of stability, we can still determine how close we are to the boundary. This is what gain and phase margins are all about.
Gain margin¶
Gain margin tells us how far we are from the boundary in terms of gain. We determine it as follows.
Find the phase crossover frequency .
Find the gain (in dB) at the phase crossover frequency.
Define the gain margin as (in dB).
The gain margin tells us how much gain we can add to the system before we hit the boundary of stability.
If , then our closed-loop system is stable, and we can increase the gain by up to dB before we hit instability.
If , then our closed-loop system is on the boundary of stability, and any increase in gain will make it unstable.
If , then our closed-loop system is unstable, and we need to decrease the gain by at least dB to achieve stability.
For the example in Figure 4, the phase crossover frequency is approximately rad/s, and the gain margin is approximately dB, which means that we can increase the gain by up to 20 dB at this frequency before we hit instability.
Phase margin¶
Phase margin tells us how far we are from the boundary in terms of phase. We determine it as follows.
Find the gain crossover frequency .
Find the phase at the gain crossover frequency.
Define the phase margin as .
The phase margin tells us how much phase lag we can add to the system before we hit the boundary of stability.
If , then our closed-loop system is stable, and we can add up to degrees of phase lag before we hit instability.
If , then our closed-loop system is on the boundary of stability, and any additional phase lag will make it unstable.
If , then our closed-loop system is unstable, and we need to add at least degrees of phase lead to achieve stability.
For the example in Figure 4, the gain crossover frequency is approximately rad/s, and the phase margin is approximately , which means that we can add up to 45 degrees of phase lag at this frequency before we hit instability.
Margin illustration¶
Although we treated the gain and phase margins separately, they often change together. Let’s see what happens as we increase in our feedback loop.
Stable example¶
Continuing with our example from Figure 2, the Bode plot of Figure 4 corresponded to closing the loop with , and we found and .
Let’s look at what happens if we use up half of our margin and increase the gain to . We can do this by evaluating the stability margins for instead of . Here is the result:
Figure 5:As we increase the gain , the magnitude plot shifts up, the gain crossover frequency moves to the right, and the gain margin and phase margin are reduced.
We observe the following:
The magnitude plot is shifted up by 10 dB but the phase plot is unchanged.
The phase crossover frequency is unchanged, but the gain margin is reduced by 10 dB because the magnitude curve moved up by 10 dB.
The gain crossover frequency has moved to the right, and the phase margin is reduced because the phase plot is decreasing as we move to the right. As anticipated, the gain margin is cut in half because we used a proportional gain that is half of the gain margin. The phase margin is also reduced, even though we didn’t change the phase plot, because the gain crossover frequency has moved to the right. We are still stable, but we are closer to instability.
Unstable example¶
Now let’s take a look at what happens if the plant has a much larger gain, let’s say . So we should make a Bode plot for the system
The Bode plot of is the same as that of but shifted up by 40 dB. Now the gain and phase crossover frequencies switch order, and both margins are negative:
Figure 6:With this large gain, the closed-loop system is now unstable (both margins are negative).
Since both margins are negative, our closed-loop system is unstable. If we want to return to stability, we need to decrease the gain by at least 20 dB, which means using a proportional gain that is smaller than .
The fact that our crossover frequencies switched order is not a coincidence. In fact, always corresponds to the case with and dB and a stable closed loop. Likewise, always corresponds to the case with and and an unstable closed loop.
Margin check¶
Based on our gain margin analysis, our original system has a gain margin of approximately 20 dB, which means it can tolerate a proportional gain of up to before it becomes unstable.
Let’s verify this using our stability criteria. The characteristic equation is:
Our stability criteria tell us that we will have stability if and only if all coefficients are positive and . In our case, this means that we need . So the gain margin of our system should be:
This is consistent with our gain margin analysis, which gave us a gain margin of approximately 20 dB. The slight discrepancy is due to the fact that we made a rough estimate from the plot rather than measuring the Bode plot exactly.
Stability summary¶
No crossings?¶
Sometimes, the Bode plot may not cross the 0 dB line or the -180° line at all. Here is what happens in these special cases:
If there is no gain crossover (the magnitude plot never crosses the 0 dB line), then due to high-frequency roll-off, the magnitude plot must be below 0 dB at all frequencies. No matter where is, we have and a stable closed loop (assuming, as always, that our system is open-loop stable). No amount of phase lag can destabilize the closed-loop system. By convention, we say is undefined and .
If there is no phase crossover (the phase plot never crosses the -180° line), then if we start above the line, we will have regardless of , and a stable closed loop (assuming, again, that our system is open-loop stable). In this case, No amount of gain can destabilize the closed-loop system. By convention, we say is undefined and .
Example with infinite margin¶
Consider the familiar first-order system: with Bode plot:
Figure 7:Bode plot for , which has infinite gain margin and a large phase margin.
The magnitude plot crosses the 0 dB line at rad/s and , but the phase plot never crosses the -180° line. So is undefined, and ; no amount of gain will destabilize the closed-loop system. We can confirm this by looking at the root locus plot:
Figure 8:Root locus plot for . Closed loop is stable for any positive gain.
Since the phase margin is finite, we can destabilize the closed-loop system by adding sufficient phase lag. We will see in the next section that one way of adding is phase lag is via time delay.
Multiple crossings?¶
The examples used above have a single gain crossover frequency and a single phase crossover frequency (or no crossings), which is typical of most systems.
It is possible for a system to have multiple gain and phase crossover frequencies. In such cases, a system could start off stable, then become unstable as we increase the gain, then become stable again as we increase the gain further, and so on.
The condition (5) tests whether a pole is on the imaginary axis, so it can identify gain values for which a pole crosses the imaginary axis. However, the Bode plot cannot tell us which way the poles are crossing.
When there was only one crossing, we could infer the direction of the crossing since all poles are in the LHP for sufficiently small gain (open-loop stability assumption). If there are multiple crossings, the Bode plot alone cannot tell us about stability and we have to rely on other tools, such as the root locus plot.
From stability to robustness¶
Gain and phase margins are not just about stability; they also give us a measure of robustness. For example, if our system model is inaccurate, i.e., our is not exactly the true system, then our Bode plot will not be exactly correct either. By ensuring that our compensator design leaves us with enough margin, we can tolerate some error in our model and be assured that our compensator will still stabilize the true system even though we designed it based on an inaccurate model.
Nyquist stability criterion (bonus)¶
An alternative way to visualize the open-loop frequency response is via a Nyquist plot. The Nyquist plot is a plot of , but instead of plotting the magnitude and phase separately as functions of frequency (as in a Bode plot), we plot the parametric curve traced out by in the complex plane as goes from to . We will not cover this topic, but it is worth knowing about it. Both Nyquist and Bode plots have their place; here is a quick comparison:
| Task | Comparison of Bode vs Nyquist |
|---|---|
| Assessing closed-loop stability | Nyquist gives a more detailed picture, revealing the exact number of unstable closed-loop poles. Bode plots only show us how far we are from a stability boundary and are difficult to interpret when there are multiple crossings. |
| Finding stability margins | Both Nyquist and Bode plots can be used to determine gain and phase margins, but Nyquist plots show phase and magnitude together, so we can visually see how close we are to the critical point (-1, 0). Nyquist is great for delays. |
| Performance analysis | Both show DC gain clearly, but Bode plots provide more detailed information about performance as a function of frequency and high-frequency roll-off. |
| Frequency information | Nyquist plots do not show frequency information at all, so we cannot directly read off bandwidth, crossover frequencies, or resonant frequencies from a Nyquist plot. Bode plots show us this information clearly. |
| Designing compensators | Bode plots are the tool of choice for loop-shaping because we can intuitively see which frequencies need more gain, more phase, etc. Nyquist plots are less intuitive for design purposes. |
| Making the plot | Bode plots are easier to draw by hand, but both can be easily generated in MATLAB using the bode and nyquist functions, respectively. |
Test your knowledge¶
Solution to Exercise 1 #
Here is the annotated Bode plot with the crossover frequencies and margins indicated:
Figure 10:Annotated version of the Bode plot in Figure 9.
We can estimate from the plot that rad/s and rad/s. The gain margin is , and the phase margin is . Since both margins are positive, the closed-loop system is stable for .
Solution to Exercise 2 #
Since we changed the sign of the gain, the Bode magnitude plot is unchanged, but the phase plot is shifted down by 180°. The resulting Bode plot is:
Figure 11:Bode plot for , which has infinite gain margin and a large phase margin.
The phase crossover frequency is at rad/s and the gain crossover frequency is at rad/s. The gain margin is , and the phase margin is . So the closed-loop system is unstable, and we need to decrease the gain by at least 20 dB and add at least 85 degrees of phase lead to achieve stability. We can confirm this by looking at the root locus plot, which is the negative locus plot of our original system:
Figure 12:Root locus plot for . The closed-loop system is unstable for sufficiently large .
Our closed-loop system is unstable (our pole is in the RHP), but we can stabilize it by using a proportional gain that is smaller than (i.e., we need to decrease the gain by at least 20 dB). This will move us backwards along the root locus until our closed-loop pole crosses the imaginary axis into the LHP.