I. Bode Plots [
Gain and phase margin |
Bandwidth frequency |
Closed loop response ]
II. The Nyquist Diagram [ The Cauchy criterion | Closed loop stability | Gain margin | Phase margin ]
In order to see how the frequency vector contributes to the Nyquist diagram more clearly, you can view our movie.
However, if we have open-loop poles or zeros on the jw axis, G(s) will not be defined at those points, and we must loop around them when we are plotting the contour. Such a contour would look as follows:
Please note that the contour loops around the pole on the jw axis. As we mentioned before, the Matlab nyquist command does not take poles or zeros on the jw axis into account and therefore produces an incorrect plot. To correct this, please download and use nyquist1.m. If we have a pole on the jw axis, we have to use nyquist1. If there are no poles or zeros on the jw-axis, or if we have pole-zero cancellation, we can use either the nyquist command or nyquist1.m.
When studying feedback controls, we are not as interested in G(s) as in the closed-loop transfer function:
G(s) --------- 1 + G(s)
Therefore, the behavior of the Nyquist diagram around the -1 point in the real axis is very important; however, the axis on the standard nyquist diagram might make it hard to see what's happening around this point. To correct this, you can add the lnyquist1.m function to your files. The lnyquist1.m command plots the Nyquist diagram using a logarithmic scale and preserves the characteristics of the -1 point.
To view a simple Nyquist plot using Matlab, we will define the following transfer function and view the Nyquist plot:
0.5 ------- s - 0.5
nyquist (0.5,[1 -0.5])
s + 2 ----- s^2
nyquist([1 2], [1 0 0])
nyquist1([1 2], [1 0 0])
lnyquist1([1 2], [1 0 0])
Note that the nyquist plot is not the correct one, the nyquist1 plot is correct, but it's hard to see what happens close to the -1 point, and the lnyquist1 plot is correct and has an appropriate scale.
Consider the negative feedback system:
Closed Loop Stability
The Nyquist criterion then states that:
Z = P + N
Note: This is only one convention for the Nyquist criterion. Another convention states that a positive N counts the counter-clockwise or anti-clockwise encirclements of -1. The P and Z variables remain the same. In this case the equation becomes Z = P - N. Throughout these tutorials, we will use a positive sign for clockwise encirclements.
It is very important (and somewhat tricky) to learn how to count the number of times that the diagram encircles -1. Therefore, we will go into some detail to help you visualize this. You can view this movie as an example.Knowing the number of right-half plane (unstable) poles in open loop (P), and the number of encirclements of -1 made by the Nyquist diagram (N), we can determine the closed-loop stability of the system. If Z = P + N is a positive, nonzero number, the closed-loop system is unstable.Another way of looking at it is to imagine you are standing on top of the -1 point and are following the diagram from beginning to end. Now ask yourself: How many times did I turn my head a full 360 degrees? Again, if the motion was clockwise, N is positive, and if the motion is anti-clockwise, N is negative.
We can also use the Nyquist diagram to find the range of gains for a closed-loop unity feedback system to be stable. The system we will test looks like this:
The first thing we need to do is find the number of positive real poles in our open-loop transfer function:
roots([1 -8 15]) ans = 5 3The poles of the open-loop transfer function are both positive. Therefore, we need two anti-clockwise (N = -2) encirclements of the Nyquist diagram in order to have a stable closed-loop system (Z = P + N). If the number of encirclements is less than two or the encirclements are not anti-clockwise, our system will be unstable.
Let's look at our Nyquist diagram for a gain of 1:
nyquist([ 1 10 24], [ 1 -8 15])
There are two anti-clockwise encirclements of -1. Therefore, the system is stable for a gain of 1. Now we will see how the system behaves if we increase the gain to 20:
nyquist(20*[ 1 10 24], [ 1 -8 15])
The diagram expanded. Therefore, we know that the system will be stable no matter how much we increase the gain. However, if we decrease the gain, the diagram will contract and the system might become unstable. Let's see what happens for a gain of 0.5:
nyquist(0.5*[ 1 10 24], [ 1 -8 15])
The system is now unstable. By trial and error we find that this system will become unstable for gains less than 0.80. We can verify our answers by zooming in on the Nyquist plots as well as by looking at the closed-loop steps responses for gains of 0.79, 0.80, and 0.81.
If you are having trouble counting the Nyquist encirclements, we suggest you try using nyquist1. The number of anti-clockwise encirclements will be displayed on your screen (remember that this number actually represents negative N, i.e. if nyquist1 shows 2, N = -2) as well as the number of open and closed-loop positive real poles.
The open-loop system represented by this plot will become unstable in closed loop if the gain is increased past a certain boundary. The negative real axis area between -1/a (defined as the point where the 180 degree phase shift occurs...that is, where the diagram crosses the real axis) and -1 represents the amount of increase in gain that can be tolerated before closed-loop instability.
If we think about it, we realize that if the gain is equal to a, the diagram will touch the -1 point:
Therefore, we say that the gain margin is 'a' units. However, we mentioned before that the gain margin is usually measured in decibels. Hence, the gain margin is :G(jw) = -1/a = a*G(jw) = a* -1/a => a*G(jw) = -1
We will now find the gain margin of the stable, open-loop transfer function we viewed before. Recall that the function is:GM = 20*log10(a) [dB]
nyquist (50, [1 9 30 40 ])
As we discussed before, all that we need to do to find the gain margin is find 'a', as defined in the preceding figure. To do this, we need to find the point where there is exactly 180 degrees of phase shift. This means that the transfer function at this point is real (has no imaginary part). The numerator is already real, so we just need to look at the denominator. When s = j*w, the only terms in the denominator that will have imaginary parts are those which are odd powers of s. Therefore, for G(j*w) to be real, we must have:
which means w=0 (this is the rightmost point in the Nyquist diagram) or w=sqrt(30). We can then find the value of G(j*w) at this point using polyval:-j w^3 + 30 j w = 0
Our answer is: -0.2174 + 0i. The imaginary part is zero, so we know that our answer is correct. We can also verify by looking at the Nyquist plot again. The real part also makes sense. Now we can proceed to find the gain margin.polyval(50,j*w)/polyval([1 9 30 40],j*w)
We found that the 180 degrees phase shift occurs at -0.2174 + 0i. This point was previously defined as -1/a. Therefore, we now have 'a', which is the gain margin. However, we need to express the gain margin in decibels,
a = 4.6 nyquist(a*50,[1 9 30 40])
Let's analyze the previous plot and think about what is happening. From our previous example we know that this particular system will be unstable in closed loop if the Nyquist diagram encircles the -1 point. However, we must also realize that if the diagram is shifted by theta degrees, it will then touch the -1 point at the negative real axis, making the system marginally stable in closed loop. Therefore, the angle required to make this system marginally stable in closed loop is called the phase margin (measured in degrees). In order to find the point we measure this angle from, we draw a circle with radius of 1, find the point in the Nyquist diagram with a magnitude of 1 (gain of zero dB), and measure the phase shift needed for this point to be at an angle of 180 deg.