# Control Systems/Nyquist Stability Criteria

| The Wikibook of: Control Systems and Control Engineering | Table of Contents | All Versions | PDF Version |
| The Wikibook of: Control Systems and Control Engineering | ← Root Locus | Controllability and Observability → | Glossary |

## Nyquist Stability Criteria

The Nyquist Stability Criteria is a test for system stability, just like the Routh-Hurwitz test, or the Root-Locus Methodology. However, the Nyquist Criteria can also give us additional information about a system. Routh-Hurwitz and Root-Locus can tell us where the poles of the system are for particular values of gain. By altering the gain of the system, we can determine if any of the poles move into the RHP, and therefore become unstable. The Nyquist Criteria, however, can tell us things about the frequency characteristics of the system. For instance, some systems with constant gain might be stable for low-frequency inputs, but become unstable for high-frequency inputs.
Here is an example of a system responding differently to different frequency input values: Consider an ordinary glass of water. If the water is exposed to ordinary sunlight, it is unlikely to heat up too much. However, if the water is exposed to microwave radiation (from inside your microwave oven, for instance), the water will quickly heat up to a boil.
Also, the Nyquist Criteria can tell us things about the phase of the input signals, the time-shift of the system, and other important information.

## Contours

A contour is a complicated mathematical construct, but luckily we only need to worry ourselves with a few points about them. We will denote contours with the Greek letter Γ (gamma). Contours are lines, drawn on a graph, that follow certain rules:
* The contour must close (it must form a complete loop)
* The contour may not cross directly through a pole of the system.
* Contours must have a direction (clockwise or counterclockwise, generally).
* A contour is called "simple" if it has no self-intersections. We only consider simple contours here.
Once we have such a contour, we can develop some important theorems about them, and finally use these theorems to derive the Nyquist stability criterion.

## Argument Principle

Here is the argument principle, which we will use to derive the stability criterion. Do not worry if you do not understand all the terminology, we will walk through it:

### The Argument Principle

    If we have a contour, Γ, drawn in one plane (say the complex laplace plane, for instance), we can map that contour into another plane, the F(s) plane, by transforming the contour with the function F(s). The resultant contour, $\Gamma _{F(s)}$ will circle the origin point of the F(s) plane N times, where N is equal to the difference between Z and P (the number of zeros and poles of the function F(s), respectively).
When we have our contour, Γ, we transform it into $\Gamma _{F(s)}$ by plugging every point of the contour into the function F(s), and taking the resultant value to be a point on the transformed contour.

### Example: First Order System

Let's say, for instance, that Γ is a unit square contour in the complex s plane. The vertices of the square are located at points I,J,K,L, as follows:
    $I=1+j$
    $J=1-j$
    $K=-1-j$
    $L=-1+j$
we must also specify the direction of our contour, and we will say (arbitrarily) that it is a clockwise contour (travels from I to J to K to L). We will also define our transform function, F(s), to be the following:
    $F(s)=2s+1$
We can factor the denominator of F(s), and we can show that there is one zero at s → -0.5, and no poles. Plotting this root on the same graph as our contour, we see clearly that it lies within the contour. Since s is a complex variable, defined with real and imaginary parts as:
    $s=\sigma +j\omega$
We know that F(s) must also be complex. We will say, for reasons of simplicity, that the axes in the F(s) plane are u and v, and are related as such:
    $F(s)=u+vj=2(\sigma +j\omega )+1$
From this relationship, we can define u and v in terms of σ and ω:
    $u=2\sigma +1$
    $v=2\omega$
Now, to transform Γ, we will plug every point of the contour into F(s), and the resultant values will be the points of $\Gamma _{F(s)}$. We will solve for complex values u and v, and we will start with the vertices, because they are the simplest examples:
    $u+vj=F(I)=3+2j$
    $u+vj=F(J)=3-2j$
    $u+vj=F(K)=-1+2j$
    $u+vj=F(L)=-1-2j$
We can take the lines in between the vertices as a function of s, and plug the entire function into the transform. Luckily, because we are using straight lines, we can simplify very much:
* Line from I to J: $\sigma =1,u=3,v=\omega$
* Line from J to K: $\omega =-1,u=2\sigma +1,v=-1$
* Line from K to L: $\sigma =-1,u=-1,v=\omega$
* Line from L to I: $\omega =1,u=2\sigma +1,v=1$
And when we graph these functions, from vertex to vertex, we see that the resultant contour in the F(s) plane is a square, but not centered at the origin, and larger in size. Notice how the contour encircles the origin of the F(s) plane one time. This will be important later on.

### Example: Second-Order System

Let's say that we have a slightly more complicated mapping function:
    $F(s)={\frac {s+0.5}{2s^{2}+2s+1}}$
We can see clearly that F(s) has a zero at s → -0.5, and a complex conjugate set of poles at s → -0.5 + 0.5j and s → -0.5 - 0.5j. We will use the same unit square contour, Γ, from above:
    $I=1+j$
    $J=1-j$
    $K=-1-j$
    $L=-1+j$
We can see clearly that the poles and the zero of F(s) lie within Γ. Setting F(s) to u + vj and solving, we get the following relationships:
    $u+vj=F(\sigma +j\omega )={\frac {(\sigma +0.5)+j(\omega )}{(2\sigma ^{2}-2\omega ^{2}+2\sigma +1)+j(2\sigma \omega +\omega )}}$
This is a little difficult now, because we need to simplify this whole expression, and separate it out into real and imaginary parts. There are two methods to doing this, neither of which is short or easy enough to demonstrate here to entirety:
* We convert the numerator and denominator polynomials into a polar representation in terms of r and θ, then perform the division, and then convert back into rectangular format.
* We plug each segment of our contour into this equation, and simplify numerically.

## The Nyquist Contour

The Nyquist contour, the contour that makes the entire nyquist criterion work, must encircle the entire unstable region of the complex plane. For analog systems, this is the right half of the complex s plane. For digital systems, this is the entire plane outside the unit circle. Remember that if a pole to the closed-loop transfer function (or equivalently a zero of the characteristic equation) lies in the unstable region of the complex plane, the system is an unstable system.

### Analog Systems

    The Nyquist contour for analog systems is an infinite semi-circle that encircles the entire right-half of the s plane. The semicircle travels up the imaginary axis from negative infinity to positive infinity. From positive infinity, the contour breaks away from the imaginary axis, in the clock-wise direction, and forms a giant semicircle.

### Digital Systems

    The Nyquist contour in digital systems is a counter-clockwise encirclement of the unit circle.

## Nyquist Criteria

Let us first introduce the most important equation when dealing with the Nyquist criterion:
    $N=Z-P$
Where:
* N is the number of encirclements of the (-1, 0) point.
* Z is the number of zeros of the characteristic equation.
* P is the number of poles in the of the open-loop characteristic equation.
With this equation stated, we can now state the Nyquist Stability Criterion:

### Nyquist Stability Criterion

    A feedback control system is stable, if and only if the contour $\Gamma _{F(s)}$ in the F(s) plane does not encircle the (-1, 0) point when P is 0.
    A feedback control system is stable, if and only if the contour $\Gamma _{F(s)}$ in the F(s) plane encircles the (-1, 0) point a number of times equal to the number of poles of F(s) enclosed by Γ.
In other words, if P is zero then N must equal zero. Otherwise, N must equal P. Essentially, we are saying that Z must always equal zero, because Z is the number of zeros of the characteristic equation (and therefore the number of poles of the closed-loop transfer function) that are in the right-half of the s plane.
Keep in mind that we don't necessarily know the locations of all the zeros of the characteristic equation. So if we find, using the nyquist criterion, that the number of poles is not equal to N, then we know that there must be a zero in the right-half plane, and that therefore the system is unstable.

## Nyquist ↔ Bode

A careful inspection of the Nyquist plot will reveal a surprising relationship to the Bode plots of the system. If we use the Bode phase plot as the angle θ, and the Bode magnitude plot as the distance r, then it becomes apparent that the Nyquist plot of a system is simply the polar representation of the Bode plots.
To obtain the Nyquist plot from the Bode plots, we take the phase angle and the magnitude value at each frequency ω. We convert the magnitude value from decibels back into gain ratios. Then, we plot the ordered pairs (r, θ) on a polar graph.

## Nyquist in the Z Domain

The Nyquist Criteria can be utilized in the digital domain in a similar manner as it is used with analog systems. The primary difference in using the criteria is that the shape of the Nyquist contour must change to encompass the unstable region of the Z plane. Therefore, instead of an infinitesimal semi-circle, the Nyquist contour for digital systems is a counter-clockwise unit circle. By changing the shape of the contour, the same N = Z - P equation holds true, and the resulting Nyquist graph will typically look identical to one from an analog system, and can be interpreted in the same way.
| ← Root Locus | Control Systems | Controllability and Observability → |