# Analyze stability of a closed-loop system with Bode

I have an open-loop system function $L(s)$ and its Bode plot is As MATLAB says, it is stable if we close the loop with unitary feedback. I thought that, seeing the Bode plots one could tell if the closed-loop system would be stable if the $0\textrm{ dB}$ crossing occured at a lower frequency than the $-180°$ crossing. I made the Blode plots for $0.01L(s)$ and got the following: Now the closed-loop system would be stable too, but this time the $0\textrm{ dB}$ crossing occurs at a lower frequency than the $-180°$ crossing. Nevertheless, in both cases the closed-loop system turns out to be stable.

Then I made the Bode plots for $0.1L(s)$ and got this: And now the closed-loop system is unstable.

So, my question is: how can one know, with just looking at the Bode plots, if the closed-loop system is going to be stable or not?

• Sorry I did not get the question. You gave three examples on hoe to deduce stability from the bode plots, what do you wish to know? – LJSilver May 15 '16 at 8:54

It is usually easier to determine closed-loop stability from a Nyquist plot. Namely the number of unstable poles of the closed-loop system will be equal to the number of unstable poles of the open-loop system plus the number of clockwise encirclements of the minus one point.

For a system with no unstable open-loop poles this translates to that you always want to cross the unit circle with the minus one point to your left, when increasing in frequency. In a bodeplot the minus one point will be located at $0\ \text{dB}$ and $-180^\circ$. So in order to cross the unit circle with the minus one point to your left, then you want to have more phase (less negative than $-180^\circ$) when you cross the $0\ \text{dB}$ line.

For an open-loop system, with unstable poles, you also have to keep the minus one point on your left, but it gets a little bit more complex. Namely you also need counter clockwise encirclements of the minus one point in order for the closed-loop to be stable.

• And how could someone see if the closed-loop system will be stable just by analyzing the Bode plots if there are open-loop unstable poles? – Tendero May 15 '16 at 15:32
• @Tendero For example this system is open-loop unstable. However in closed-loop it is stable, because at 0 rad/s it is on the negative real line outside the unit circle, but when it crosses the 0 dB line its phase is bigger than -180° and for big frequencies it goes to the origin. This is half a counterclockwise encirclement of the minus one point, the other half comes from the negative frequencies. For systems with integrators it will be more complicated at 0 rad/s, since you then also have to consider the encirclements from $0^-$ to $0^+$. – fibonatic May 15 '16 at 17:21

I thought that, seeing the Bode plots one could tell if the closed-loop system would be stable if the 0 dB crossing occured at a lower frequency than the −180° crossing.

The usual formulation is to say that the phase margin at the 0dB crossing is > 0. Matlab adds a vertical line to the phase diagram at the frequency where 0dB is. The length of that line is the phase margin.

The important thing to remember is that $L(s) \neq 0.1 L(s) \neq 0.01L(s)$. By multiplying a transfer function with a number, you create a different transfer function (that describes a different system), which may or may not be stable.

The answer to the question why something multiplied by an arbitrary number, that's different from 1, does not behave as if being multiplied by 1 is because an arbitrary number different from 1 is, well, different from 1.

The phase margin is a good way to decide about stability of a system in a yes/no fashion.

But it looks like you actually want to add a variable gain $k$ to the transfer function. The question now is, for what values of $k$ is $kL(s)$ stable?

You can answer that question by choosing arbitrary values for $k$ and do the above analysis. As you experienced, this is somewhat tedious and only answering the question for discrete values of $k$.

To get the range of values for $k$, you have to approach the problem from the other direction, that is: find the gain margin from looking at the phase diagram instead of finding the phase margin from looking at the magnitude diagram.

You know that crossing the line of -180° is the critical point where the system becomes unstable at the gain of 1. Again, changing perspective now: look at the phase diagram and find the points (frequencies) where the value is -180°, now find the corresponding gains in the magnitude diagram above.

As you can see, matlab is already doing that for you. Your phase diagram intersects -180° at two points and matlab draws the gains at those frequencies into the magnitude diagram.

Changing the gain, means moving the plot in the magnitude diagram up and down. In your case, if you (choose a gain so that) move the plot down as far as the right gain margin is, the system will become unstable at that point. Moving the the plot further down (decreasing $k$ even further) will result in a an unstable system until the gain is decreased below the value of the left gain margin. The system will be stable for lower $k$ values.

I added two shifted versions of the magnitude diagram into the first body plot, one with the right gain magin (red) and one with the left gain margin (red): If the magnitude diagram is between the red and green lines (blue area), the system is unstable. This is because the original condition for stability is false in that area (and only in that area): The phase margin at the 0dB crossing is > 0.

If you draw the root locus, you will see that there's one branch that starts in the left hand side (stable) moves into the right hand side (unstable) and later returns to the left hand side. The values for $k$ at which it crosses the imaginary axes are the two values for the gain margin.

Btw, this is why it's called "pole placement": you move the poles around in the root locus so that the system becomes stable.

tl, dr;

The bode plot has two points that are critical for stability:

1. the 0dB crossing in the magnitude diagram
2. the -180° crossing in the phase diagram

looking at either point in one diagram, and looking at the other diagram at the same frequency allows to make some assumptions about the stability of the system:

1. At the frequency of the 0dB crossing in the magnitude diagram, the value of the phase diagram should be > -180°. In other words: there should be a positive phase margin. The phase margin is a qualitative measure about how far away the system is from being unstable. The bigger the phase margin, the further it is away from instability.
2. The range of frequencies in the phase diagram with a value < -180° (In other words: a negative phase margin) are those frequencies where the values of the magnitude diagram are not allowed to cross 0dB in order to ensure stability of the system. The boundaries of the range of frequencies (or ranges if there are many) are the -180° crossings in the phase diagram. The gain margins in the magnitude diagram at those frequencies determine the values for the boundary of the range (or boundaries of ranges) for the value of a gain $k$ for which the system will be stable.
• Thanks for the answer. Just to see if I got this right: a) Would the system $kL(s)$ be stable for every $k$ if the phase is always greater than -180°? b) Would the system $kL(s)$ be unstable for every $k$ if the phase is always less than -180°? – Tendero May 15 '16 at 14:37
• @Tendero yes that sounds legit – null May 15 '16 at 15:11
• Look at this Bode plot. It has a positive phase margin but it is unstable. I don't get it... What's happening there? – Tendero May 15 '16 at 15:12
• @Tendero That system system will be closed-loop unstable, because the open-loop is also unstable. – fibonatic May 15 '16 at 15:19
• @Tendero The open-loop is unstable because near 1 rad/s there seems to be a pole, since the slope of the magnitude becomes steeper downwards, but the phase increases. This is only the case if the pole is unstable. However an unstable open-loop pole does not mean that the closed-loop has to be unstable, see my answer. – fibonatic May 15 '16 at 15:29

Seems like you found a limitation in Matlab as many of the assumptions are likely to assume you don't have your first resonance/eigenmode at such a low frequency. I have systems that will swing to -180 almost immediately (think of any mass only system like mag-lev).

They are made stable by increasing the bandwidth or cross-over to a significantly higher frequency than where the pole is. A 100hz bandwidth servo should handle 10hz disturbances all day if tuned as such - just don't rely on the straight bode output from Matlab to tell you that!

Springs and damping attribute no phase and 90 degrees of phase respectively, so you can make the dominate load to be the spring with a high enough stiffness to dominate the mass*accel effect for the lower frequencies to keep phase and have damping to control the behavior around your cut-off frequency where you can often see some amplification.

NOW - if someone could help with HOW to use a bode with a slow pole properly to assess phase and gain margin, I would be elated because I have had to rely on some closed loop methods of increasing gain and also injecting phase delay until instability is observed rather than from my good friend Bode.

This particular issue WAS in fact a pseudo single axis mag-lev without any damping to speak of.