# Design Tools

## Root Locus

![Figure 7: Feedback Controller](https://3896527066-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MQYqMkpf2WPiP6MKWRe%2Fuploads%2Fgit-blob-b30b48e8feda646fda7165e8798eab48494e94cb%2Fd41eba4d0a3ea424532017d7acddb025ad2d32f8.png?alt=media)

Suppose we choose to control the plant by scaling our error signal by $$K$$ and then put the controller on the feedback path like in Figure 7. It would be helpful for us to understand how the closed loop poles of the feedback system change as $$K$$ is varied over the range $$\[0, \infty)$$. First, suppose

$$G(s) = \frac{N\_G}{D\_G} \qquad H(s) = \frac{N\_H}{D\_H}.$$

Then the transfer function of the overall system is

$$\frac{Y(s)}{R(s)} = \frac{kG(s)}{1+kG(s)H(s)} = \frac{KN\_GD\_H}{D\_GD\_H+KN\_GN\_H}.$$

The closed loop poles are the roots of the denominator polynomial (called the characteristic polynomial).

$$\Delta(s) = D\_GD\_H+KN\_GN\_H = 1 + K\frac{N\_GN\_H}{D\_GD\_H} = 0 \qquad (14)$$

Clearly, no matter what $$K$$ is, the poles must satisfy two criteria.

$$\left|k\frac{N\_GN\_H}{D\_GD\_H}\right| = 1 \qquad \angle K\frac{N\_GN\_H}{D\_GD\_H} = (2r+1)\pi,\quad r\in\mathbb{Z} \qquad (15)$$

{% hint style="info" %}

#### Definition 30

The root locus is the set of all $$s\in\mathbb{C}$$ such that $$\exists K$$ where $$\Delta(s) = 0$$.
{% endhint %}

All points on the root locus must satisfy Equation 15.

### Root Locus Rules

First, notice that the roots of $$\Delta(s)$$ are the closed loop poles of the system.

{% hint style="info" %}

#### Theorem 6

The number of branches in the root locus is equal to the number of closed loop poles where a branch is the path traveled by a single pole as $$K$$is varied.
{% endhint %}

Next, because we are dealing with real systems, complex poles must have a corresponding conjugate pole.

{% hint style="info" %}

#### Theorem 7

The root locus is symmetric about the real axis.
{% endhint %}

Going back to Equation 15, we can alternatively express the angle criteria as

$$\angle K \frac{\prod\_{i=1}^m (s-z\_i)}{\prod\_{i=1}^n (s-p\_i)} = \sum\_{i=1}^m \angle (s-z\_i) - \sum\_{i=1}^n \angle (s-p\_i)$$

where $$z\_i$$ are open loop zeros and $$p\_i$$ are open loop poles. If we restrict ourselves to the real axis, then given a closed loop pole $$s$$, each $$z\_i > s$$ will contribute $$-180$$˚and each $$p\_i > s$$ will contribute $$180$$˚while the $$z\_i, p\_i < s$$ will contribute $$0$$˚.

{% hint style="info" %}

#### Theorem 8

The real axis segments of the root locus are to the left of an odd number of open loop poles and zeros.
{% endhint %}

When $$K$$ is small, then the poles look like the open loop poles. As $$K$$ grows very large, then the poles look like the open loop zeros.

{% hint style="info" %}

#### Theorem 9

The root locus begins at the open loop poles and ends at the open loop zeros
{% endhint %}

If there are more poles ($$n$$) then zeros ($$m$$), then not all of the poles will end up at a zero in the limit. This means that $$n-m$$ poles must branch off to infinity.

$$\lim\_{|s|\to\infty} kH(s)G(s) \approx \lim\_{|s|\to\infty}k\frac{s^m}{s^n} = (2l+1)\pi \implies s^{n-m} = re^{j\theta(n-m)} \implies \theta = \frac{(2l+1)\pi}{n-m}$$

{% hint style="info" %}

#### Theorem 10

In the limit, poles will asymptotically approach

$$\theta = \frac{-(2l+1)\pi}{n-m},$$

and the real axis intercept of these asymptotes is

$$\sigma = \frac{\sum\_{i=1}^m p\_i - \sum\_{i=1}^n z\_i}{n-m}.$$
{% endhint %}

If there is a gap between real-axis segments, in order to end at an open loop zero, poles must sometimes break away from the real axis and then re-enter.

{% hint style="info" %}

#### Theorem 11

The break-in and break-away points satisfy the equation

$$\sum\_{i=1}^n \frac{1}{\sigma + p\_i} = \sum\_{i=1}^m \frac{1}{\sigma+z\_i}.$$
{% endhint %}

Since the angles can travel asymptotically, they sometimes cross the imaginary axis.

{% hint style="info" %}

#### Theorem 12

The root locus intersects the imaginary axis at points where

$$\sum\_{i=1}^m \angle (j\omega + z\_i) - \sum\_{i=1}^n \angle (j\omega + p\_i) = (2l+1)\pi.$$
{% endhint %}

Similarly, if the poles begin at complex locations, then we can find their angle of departure.

{% hint style="info" %}

#### Theorem 13

Poles beginning at complex locations will depart at an angle $$\theta$$ where

$$\sum\_{i=1}^m (p + z\_i) - \sum\_{i=1}^n (p + p\_i) = (2l+1)\pi$$
{% endhint %}

Finally, since $$|KG(s)H(s)|=1$$, we can determine $$K$$ if we know a particular pole location.

{% hint style="info" %}

#### Theorem 14

Given a pole location $$p$$,

$$K = \left|\frac{1}{G(p)H(p)}\right|.$$
{% endhint %}

### Generalized Root Locus

Because the Root Locus rules are derived from the characteristic polynomial $$\Delta(s)$$ of the closed-loop system, they can be used not just to find how the closed loop poles vary with a gain, but also to find how the closed loop poles vary with an open loop pole. Suppose that $$G(s) = \frac{N\_G}{(s+k)\prod\_i(s+p\_i)}$$ and $$H(s) = 1$$. Then

$$\Delta(s) = (s+k)\prod\_i(s+p\_i) + N\_G = 1 + k\frac{\prod\_i (s+p\_i) }{N\_G + s\prod\_i(s+p\_i)} = 0$$

Thus if we apply the root locus rules to the open loop system

$$Y(s) = \frac{\prod\_i (s+p\_i) }{N\_G + s\prod\_i(s+p\_i)}$$

then we can capture the behavior of the closed loop poles of the original system as we vary the location of the open loop pole we control.

## Bode Plots

{% hint style="info" %}

#### Definition 31

A Bode plot is a plot of the magnitude and phase of the frequency response with the magnitude on a log-log scale and the phase on a semi-log scale.
{% endhint %}

If we write the frequency response in polar form,

$$G(j\omega) = K \frac{(j\omega)^{N\_{z0}}}{(j\omega)^{N\_{p0}}}\frac{\prod\_{i=0}^{n}{(1+\frac{j\omega}{\omega\_{zi}})}}{\prod\_{k=0}^{m}{(1+\frac{j\omega}{\omega\_{pk}})}} = Ke^{j\frac{\pi}{2}(N\_{z0}-N\_{p0})} \frac{\prod\_{i=0}^{n}{r\_{zi}}}{\prod\_{k=0}^{m}{r\_{pk}}} e^{j(\sum\_{i=0}^{n}{z\_i} - \sum\_{k=0}^{m}{p\_k})}.$$

Each $$r$$ is the magnitude of a factor $$1 + \frac{j\omega}{\omega\_n}$$ where $$\omega\_n$$ is either a zero or a pole, $$z\_i, p\_k$$ are the phases of each factor, and $$N\_{z0}, N\_{p0}$$ are the number of zeros and poles at 0. By writing $$G(\omega)$$ this way, it is clear that

$$|G(\omega)| = K \frac{\prod\_{i=0}^{n}{r\_{zi}}}{\prod\_{k=0}^{m}{r\_{pk}}}.$$

If we take the convert this to decibels, we get

$$20\log(|G(\omega)|) = 20\log(K) + 20\sum\_{i=0}^{n}{\log(r\_{zi})} - 20\sum\_{k=0}^{m}{\log(r\_{pk})}$$

Likewise, the exponential form of $$G(\omega)$$ tells us that

$$\angle G(\omega) = \frac{\pi}{2}(N\_{z0}-N\_{p0})+ (\sum\_{i=0}^{n}{z\_i} - \sum\_{k=0}^{m}{p\_k}).$$

Each $$p\_k$$ and $$z\_i$$ are of the form $$1 + \frac{j\omega}{\omega\_n}$$. If $$\omega > 10\omega\_n$$, then $$p\_k, z\_i \approx \omega\_n$$. Likewise, if $$\omega < \frac{\omega\_n}{10}$$, $$p\_k, z\_i \approx 1$$. This means we can approximate bode plots using piece-wise linear segments using the following rules.

1. Each zero $$\omega\_z$$ contributes $$20\text{dB/dec}$$ to magnitude starting at $$\omega\_z$$.
2. Each pole $$\omega\_p$$ contributes $$-20\text{dB/dec}$$ to magnitude starting at $$\omega\_p$$.
3. Each zero $$\omega\_z$$ contributes $$45\text{˚/dec}$$ to phase starting at $$\frac{\omega\_z}{10}$$ and ending at $$10\omega\_z$$.
4. Each pole $$\omega\_p$$ contributes $$-45\text{˚/dec}$$ to phase starting at $$\frac{\omega\_p}{10}$$ and ending at $$10\omega\_p$$.

One useful way to use bode plots is to approximate the gain and phase margin because they can easily be seen visually from the plots themselves.

## Nyquist Criteria

![Figure 8: Feedback Controller](https://3896527066-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MQYqMkpf2WPiP6MKWRe%2Fuploads%2Fgit-blob-bb1782cdf9ceb81e923c8663a6235abaf2810ba0%2F04059550ef3c93aef7f54ef1df54ed95d4d42931.png?alt=media)

Consider the basic feedback system in Figure 8 and suppose that

$$G(s) = \frac{N\_G}{D\_G} \qquad H(s) = \frac{N\_H}{D\_H}.$$

Then the feedback transfer function is

$$\frac{Y(s)}{R(s)} = \frac{G}{1+G(s)H(s)} = \frac{N\_GD\_H}{D\_GD\_H + N\_GN\_H}.$$

If we focus specifically on the poles of the system, then we see

$$1+GH = 1 + \frac{N\_GN\_H}{D\_GD\_H} = \frac{N\_GN\_H+D\_GD\_H}{D\_GD\_H}$$

From here, we can see that the poles of $$1+GH$$ are the poles of the open loop system whereas the zeros of $$1+GH$$ are the poles of the closed loop system.

{% hint style="info" %}

#### Definition 32

A contour is a closed loop set of points in the complex plane.
{% endhint %}

{% hint style="info" %}

#### Definition 33

A mapping is a function that takes a point in the complex plane and transforms it into another point in the complex plane.
{% endhint %}

{% hint style="info" %}

#### Definition 34

The Nyquist Criterion says that if $$N$$ is the number of counter-clockwise encirclements of zero of a contour mapped by a transfer function $$F(s)$$, $$P$$ is the number of poles in the contour, and $$Z$$ is the number of zeros in the contour, then

$$N = P - Z. \qquad (16)$$
{% endhint %}

Thus, given an open loop transfer function $$GH$$, we can determine its stability. We already know $$P$$ from the poles of the open loop system, and we can find $$N$$ by defining a contour which encapsulates the right half plane and use Equation 16 to find $$Z$$. However, remember that we need to find the RHP poles of $$1+GH$$. This shifts our mapping to the right by $$1$$, so we can instead just let $$N$$ be the number of encirclements of $$-1$$. Once we have $$Z$$, we know how many RHP poles the closed loop transfer function will have because they are the same as the RHP zeros of the $$1+GH$$. We can extend the Nyquist Criterion to finding a range of gains that would make the open-loop system $$kG(s)H(s)$$ stable by looking for the encirclements of $$\frac{-1}{K}$$.

The contour which is easiest to find the mapping for is the one which starts at the origin, travels up the imaginary axis, encapsulates the right half plane, and then travels back up the imaginary axis back to the origin in a counter-clockwise fasion. This is the easiest because while the contour is on the imaginary axis, the mapping is just the frequency response of the system, and we can use the Bode plot of the system in order to draw the contour because each point on the mapping is a complex vector, and the bode plot can give us both the magnitude and angle of that vector.
