Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

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 G(jω)G(j\omega). For example, consider the unstable system G(s)=1s1G(s) = \frac{-1}{s-1}. We can compute its frequency response as follows:

G(jω)=1jω1=1+jω1+ω2G(j\omega) = \frac{-1}{j\omega - 1} = \frac{1+j\omega}{\sqrt{1+\omega^2}}

Therefore, M(ω)=11+ω2M(\omega) = \frac{1}{\sqrt{1+\omega^2}} and ϕ(ω)=atan(ω)\phi(\omega) = \atan(\omega). This looks very similar to the frequency response of 1s+1\frac{1}{s+1}. In fact, several different permutations of this system have the same magnitude plot but different phase plots:

Bode plots of several different first-order systems, all with 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

G(s)=s1+ε(s+1)(s1)=1s+1+εs21G(s) = \frac{s-1+\epsilon}{(s+1)(s-1)} = \frac{1}{s+1} + \frac{\epsilon}{s^2-1}

where ε>0\epsilon > 0 is a small positive number. This system has an unstable pole at s=1s=1 that is almost canceled by a RHP zero at s=1εs=1-\epsilon. So the system is unstable. Its (theoretical) frequency response is:

G(jω)=1jω+1same as 1s+1  εjω2+1small perturbationG(j\omega) = \underbrace{\frac{1}{j\omega+1}}_{\textsf{same as $\frac{1}{s+1}$}} \;-\underbrace{\frac{\epsilon}{\vphantom{j}\omega^2+1}}_{\textsf{small perturbation}}

So as ε0\epsilon \to 0 the frequency response of our unstable G(s)G(s) and its corresponding Bode plot look indistinguishable from 1s+1\frac{1}{s+1}, 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:

G(s)=1s(s+1)(s/10+1)G(s) = \frac{1}{s(s+1)(s/10 + 1)}

This system is marginally stable. Now suppose we close the loop with proportional feedback K>0K>0, as shown in the block diagram below:

Standard feedback interconnection of a system G(s) with a proportional controller K.

Figure 2:Standard feedback interconnection of a system G(s)G(s) with a proportional controller KK.

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 KK. We can confirm this by sketching the root locus plot:

Root locus plot for G(s) defined in Eq. .

Figure 3:Root locus plot for G(s)G(s) defined in Eq. (4).

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 K=1K=1. The characteristic equation of the closed-loop system is: 1+G(s)=01+G(s) = 0. If we are right on the boundary of stability, then this equation will have a solution on the imaginary axis, so there is some ω>0\omega>0 for which G(jω)=1G(j\omega) = -1. So there should exist a frequency ω\omega such that G(jω)=1|G(j\omega)|=1 (0 dB) and G(jω)=180°\angle G(j\omega) = -180\degree. In other words, there should be some ω\omega for which the Bode plot satisfies:

M(ω)=0 dBandϕ(ω)=180°\boxed{ M(\omega) = 0\text{ dB}\quad\textsf{and}\quad \phi(\omega) = -180\degree }

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:

If ωcg=ωcp\omega_{cg} = \omega_{cp}, then we are on the boundary of stability. We illustrate these concepts on the Bode plot of G(s)G(s) defined in Eq. (4):

Bode plot for G(s) defined in Eq. , with crossover frequencies and stability margins indicated.

Figure 4:Bode plot for G(s)G(s) 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.

  1. Find the phase crossover frequency ωcp\omega_{cp}.

  2. Find the gain M(ωcp)M(\omega_{cp}) (in dB) at the phase crossover frequency.

  3. Define the gain margin as GM=M(ωcp)\GM = -M(\omega_{cp}) (in dB).

The gain margin tells us how much gain we can add to the system before we hit the boundary of stability.

For the example in Figure 4, the phase crossover frequency is approximately ωcp3\omega_{cp} \approx 3 rad/s, and the gain margin is approximately GM20\GM \approx 20 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.

  1. Find the gain crossover frequency ωcg\omega_{cg}.

  2. Find the phase ϕ(ωcg)\phi(\omega_{cg}) at the gain crossover frequency.

  3. Define the phase margin as PM=180°+ϕ(ωcg)\PM = 180\degree + \phi(\omega_{cg}).

The phase margin tells us how much phase lag we can add to the system before we hit the boundary of stability.

For the example in Figure 4, the gain crossover frequency is approximately ωcg0.8\omega_{cg} \approx 0.8 rad/s, and the phase margin is approximately PM45°\PM \approx 45\degree, 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 KK 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 K=1K=1, and we found GM20 dB\GM \approx 20\text{ dB} and PM45°\PM \approx 45\degree.

Let’s look at what happens if we use up half of our margin and increase the gain to K=10 dB3.16K=10 \text{ dB} \approx 3.16. We can do this by evaluating the stability margins for 3.16G(s)3.16\cdot G(s) instead of G(s)G(s). Here is the result:

As we increase the gain K, the magnitude plot shifts up, the gain crossover frequency \omega_{cg} moves to the right, and the gain margin \GM and phase margin \PM are reduced.

Figure 5:As we increase the gain KK, the magnitude plot shifts up, the gain crossover frequency ωcg\omega_{cg} moves to the right, and the gain margin GM\GM and phase margin PM\PM are reduced.

We observe the following:

Unstable example

Now let’s take a look at what happens if the plant has a much larger gain, let’s say K=40 dB=100K=40 \text{ dB} = 100. So we should make a Bode plot for the system

100G(s)=100s(s+1)(s/10+1)100 G(s) = \frac{100}{s(s+1)(s/10 + 1)}

The Bode plot of 100G(s)100 G(s) is the same as that of G(s)G(s) but shifted up by 40 dB. Now the gain and phase crossover frequencies switch order, and both margins are negative:

With this large gain, the closed-loop system is now unstable (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 K=0.1K=0.1.

The fact that our crossover frequencies switched order is not a coincidence. In fact, ωcg<ωcp\omega_{cg} < \omega_{cp} always corresponds to the case with PM>0°\PM > 0\degree and GM>0\GM > 0 dB and a stable closed loop. Likewise, ωcg>ωcp\omega_{cg} > \omega_{cp} always corresponds to the case with PM<0°\PM < 0\degree and GM<0 dB\GM < 0 \text{ dB} and an unstable closed loop.

Margin check

Based on our gain margin analysis, our original system G(s)G(s) has a gain margin of approximately 20 dB, which means it can tolerate a proportional gain of up to K10K\approx 10 before it becomes unstable.

Let’s verify this using our stability criteria. The characteristic equation is:

1+KG(s)=0    s(s+1)(s/10+1)+K=0    s3+11s2+10s+10K=0\begin{aligned} 1+KG(s) &= 0 \\ \implies\quad s(s+1)(s/10 + 1) + K &= 0 \\ \implies\quad s^3 + 11 s^2 + 10 s + 10K &= 0 \end{aligned}

Our stability criteria tell us that we will have stability if and only if all coefficients are positive and a2a1>a0a_2 a_1 > a_0. In our case, this means that we need 0<K<110 < K < 11. So the gain margin of our system should be:

GM=20log10(11)20.8 dB\GM = 20 \log_{10}(11) \approx 20.8 \text{ dB}

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:

Example with infinite margin

Consider the familiar first-order system: G(s)=10s+1G(s) = \frac{10}{s+1} with Bode plot:

Bode plot for G(s) = \frac{10}{s+1}, which has infinite gain margin and a large phase margin.

Figure 7:Bode plot for G(s)=10s+1G(s) = \frac{10}{s+1}, which has infinite gain margin and a large phase margin.

The magnitude plot crosses the 0 dB line at ωcg10\omega_{cg} \approx 10 rad/s and PM95°\PM \approx 95\degree, but the phase plot never crosses the -180° line. So ωcp\omega_{cp} is undefined, and GM=+\GM = +\infty; no amount of gain will destabilize the closed-loop system. We can confirm this by looking at the root locus plot:

Root locus plot for G(s) = \frac{10}{s+1}. Closed loop is stable for any positive gain.

Figure 8:Root locus plot for G(s)=10s+1G(s) = \frac{10}{s+1}. 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 G(s)G(s) 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 G(jω)G(j\omega), 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 G(jω)G(j\omega) in the complex plane as ω\omega goes from -\infty to ++\infty. 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:

TaskComparison of Bode vs Nyquist
Assessing closed-loop stabilityNyquist 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 marginsBoth 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 analysisBoth show DC gain clearly, but Bode plots provide more detailed information about performance as a function of frequency and high-frequency roll-off.
Frequency informationNyquist 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 compensatorsBode 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 plotBode 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:

Annotated version of the Bode plot in .

Figure 10:Annotated version of the Bode plot in Figure 9.

We can estimate from the plot that ωcg0.5\omega_{cg} \approx 0.5 rad/s and ωcp100\omega_{cp} \approx 100 rad/s. The gain margin is GM50 dB\GM \approx 50\text{ dB}, and the phase margin is PM100°\PM \approx 100\degree. Since both margins are positive, the closed-loop system is stable for K=1K=1.

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:

Bode plot for G(s) = \frac{-10}{s+1}, which has infinite gain margin and a large phase margin.

Figure 11:Bode plot for G(s)=10s+1G(s) = \frac{-10}{s+1}, which has infinite gain margin and a large phase margin.

The phase crossover frequency is at ωcp=0\omega_{cp} = 0 rad/s and the gain crossover frequency is at ωcg10\omega_{cg} \approx 10 rad/s. The gain margin is GM=M(ωcp)=20 dB\GM = -M(\omega_{cp}) = -20 \text{ dB}, and the phase margin is PM85°\PM \approx -85\degree. 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:

Root locus plot for G(s) = \frac{-10}{s+1}. The closed-loop system is unstable for sufficiently large K.

Figure 12:Root locus plot for G(s)=10s+1G(s) = \frac{-10}{s+1}. The closed-loop system is unstable for sufficiently large KK.

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 K=0.1K=0.1 (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.