# Control Systems/Standard Forms

## Companion Form

A **companion form** contains the coefficients of a corresponding
characteristic polynomial along one of its far rows or columns. For
example, one companion form matrix is:

$$\begin{bmatrix} 0 & 0 & 0 & \cdots & 0 & -a_0 \\
                       1 & 0 & 0 & \cdots & 0 & -a_1 \\
                       0 & 1 & 0 & \cdots & 0 & -a_2 \\
                       0 & 0 & 1 & \cdots & 0 & -a_3 \\
                       \vdots & \vdots & \vdots &\ddots & \vdots & \vdots \\
                       0 & 0 & 0 & \cdots & 1 & -a_{n-1}
       \end{bmatrix}$$

and another is:

$$\begin{bmatrix} -a_{n-1} & -a_{n-2} & -a_{n-3} & \cdots & -a_1 & -a_0 \\
                       1 & 0 & 0 & \cdots & 0 & 0 \\
                       0 & 1 & 0 & \cdots & 0 & 0 \\
                       0 & 0 & 1 & \cdots & 0 & 0 \\
                       \vdots & \vdots & \vdots &\ddots & \vdots & \vdots \\
                       0 & 0 & 0 & \cdots & 1 & 0
       \end{bmatrix}$$

Two companion forms are convenient to use in control theory, namely the
observable canonical form and the controllable canonical form. These two
forms are roughly transposes of each other (just as observability and
controllability are dual ideas). When placed in one of these forms, the
design of controllers or observers is simplified because the structure
of the system is made apparent (and is easily modified with the desired
control).

### Observable Canonical Form

**Observable-Canonical Form** is helpful in several cases, especially
for designing observers.

The observable-canonical form is as follows:

$$A = \begin{bmatrix} -a_1 &  1 & 0 & \cdots & 0 \\
                       -a_2 & 0 & 1 & \cdots & 0 \\
                       \vdots & \vdots &  \vdots & \ddots & \vdots \\
                       -a_{n-1} &  0 & 0 & \cdots & 1 \\
                       -a_n & 0 & 0 & \cdots & 0
       \end{bmatrix}$$

$$B = \begin{bmatrix} b_1 \\ b_2 \\ \vdots \\ b_n \end{bmatrix}$$

$$C = \begin{bmatrix} 1 &  0 & \cdots & 0 \end{bmatrix}$$

### Controllable Canonical Form

**Controllable-Canonical Form** is helpful in many cases, especially for
designing controllers when the full state of the system is known.

The controllable-canonical form is as follows:

$$A = \begin{bmatrix} -a_1 & -a_2 & -a_3 & \cdots & -a_{n-1} & -a_n \\
                       1 & 0 & 0 & \cdots & 0 & 0 \\
                       0 & 1 & 0 & \cdots & 0 & 0 \\
                       0 & 0 & 1 & \cdots & 0 & 0 \\
                       \vdots & \vdots & \vdots &\ddots & \vdots & \vdots \\
                       0 & 0 & 0 & \cdots & 1 & 0
       \end{bmatrix}$$

$$B = \begin{bmatrix} 1 \\ 0 \\ \vdots \\ 0 \end{bmatrix}$$

$$C = \begin{bmatrix} b_1 & b_2 & b_3 & \cdots & b_n \end{bmatrix}$$

$$D = \begin{bmatrix} b_0 \end{bmatrix}$$

If we have two spaces, space *v* which is the original space of the
system (*A*, *B*, *C*, and *D*), then we can transform our system into
the *w* space which is in controllable-canonical form (*A~w~*, *B~w~*,
*C~w~*, *D~w~*) using a transformation matrix *T~w~*. We define this
transformation matrix as:

$$T = \zeta_v \zeta_w^{-1}$$

Where ζ is the controllability matrix.

Notice that we know beforehand *A~w~* and *B~w~*, since we know both the
form of the matrices and the coefficients of the equation (e.g. a linear
ODE with constant coefficients or a transfer function).

We can form ζ~w~ if we know these two matrices. We can then use this
matrix to create our transformation matrix.

We will discuss the controllable canonical form later when discussing
state feedback and closed-loop systems.

### Phase Variable Form

The **Phase Variable Form** is obtained simply by renumbering the phase
variables in the opposite order of the controllable canonical form.
Thus:

$$A_c = \begin{bmatrix}
                           0 & 1 & \cdots & 0 & 0 & 0\\
                           \vdots & \vdots &\ddots & \vdots & \vdots & \vdots \\
                           0 & 0 & \cdots & 1 & 0 & 0\\
                           0 & 0 & \cdots & 0 & 1 & 0\\
                           0 & 0 & \cdots & 0 & 0 & 1\\
                        -a_n & -a_{n-1} & -a_{n-2} & \cdots & -a_2 & -a_1
       \end{bmatrix}$$

$$B_c = \begin{bmatrix} 0 \\ 0 \\ \vdots \\ 1 \end{bmatrix}$$

$$C_c = \begin{bmatrix} b_n & b_{n-1} & \cdots & b_2 & b_1 \end{bmatrix}$$

$$D_c = \begin{bmatrix} b_0 \end{bmatrix}$$

## Modal Form

In this form, the state matrix is a diagonal matrix of its
(non-repeated) eigenvalues. The control has a unitary influence on each
eigenspace, and the output is a linear combination of the contributions
from the eigenspaces (where the weights are the complex residuals at
each pole).

$$A_m = \begin{bmatrix} -p_1 & 0 & 0 & \cdots & 0 & 0 \\
                       0 & -p_2 & 0 & \cdots & 0 & 0 \\
                       0 & 0 & -p_3 & \cdots & 0 & 0 \\
                       \vdots & \vdots & \vdots &\ddots & \vdots & \vdots \\
                       0 & 0 & 0 & \cdots & 0 & -p_n
       \end{bmatrix}$$

$$B_m = \begin{bmatrix} 1 \\ 1 \\ \vdots \\ 1 \end{bmatrix}$$

$$C_m = \begin{bmatrix} c_1 & c_2  & \cdots & c_n \end{bmatrix}$$

$$D_m = \begin{bmatrix} D_c \end{bmatrix}$$

### Jordan Form

This \"almost diagonal\" form handles the case where eigenvalues are
repeated. The repeated eigenvalues represent a multi-dimensional
eigenspace, and so the control only enters the eigenspace once and it\'s
integrated through the other states of that small subsystem.

$$A = \begin{bmatrix}
                    -p_1 & 1 & 0 & 0 & 0 & \cdots & 0 & 0 \\
                       0 & -p_1 & 1 & 0 & 0 & \cdots & 0 & 0 \\
                       0 & 0 & -p_1 & 0 & 0 & \cdots & 0 & 0 \\
                       0 & 0 & 0 & -p_4 & 0 &\cdots & 0 & 0 \\
                       \vdots & \vdots & \vdots & \vdots & \vdots &\ddots & \vdots & \vdots \\
                       0 & 0 & 0 & 0 & 0 & \cdots & 0 & -p_n
       \end{bmatrix}$$

$$B = \begin{bmatrix} 0 \\ 0 \\ 1 \\ 1 \\ \vdots \\ 1 \end{bmatrix}$$

$$C = \begin{bmatrix} c_1 & c_2 & \cdots  & c_n \end{bmatrix}$$

## Computing Standard Forms in MATLAB

MATLAB can convert a transfer function into a control canonical form by
using the command tf2ss.

`tf2ss(num, den);`\
`% num and den on the form: [x_0*s^n, x_1*s^n-1,..., x_n*s^n-n].`

MATLAB contains a function for automatically transforming a state-space
equation into a companion

(e.g., controllable or observable canonical form) form.

`[Ap, Bp, Cp, Dp, P] = canon(A, B, C, D, 'companion');`

Moving from one companion form to the other usually involves elementary
operations on matrices and vectors (e.g., transposes or interchanging
rows). Given a vector with the coefficients of a characteristic
polynomial, MATLAB can compute a companion form with the coefficients in
the top row (there are other 3 possible companion forms not generated by
that function)

`compan(P)`

Given another vector with the coefficients of a transfer function\'s
numerator polynomial, the `canon` command can do the same.

`[Ap, Bp, Cp, Dp, P] = canon(tf(Pnum,Pden), 'companion');`

The same command can be used to transform a state-space equation into a
modal (e.g., diagonal) form.

`[Ap, Bp, Cp, Dp, P] = canon(A, B, C, D, 'modal');`

However, MATLAB also includes a command to compute the Jordan form of a
matrix, a modified modal form suited for matrices with repeated
eigenvalues.

`jordan(A);`

## Computing Standard Forms by Hand

### Control Canonical Form

We are given a system that is described by the transfer function:

$$\frac{Y(s)}{U(s)} = \frac{s^2+6s+8}{s^3+9s^2+23s+15}$$

and are now tasked to obtain the state-space matrixes in control
canonical form. We first note that the order of the numerator is 2,
while the corresponding order is 3 in the denominator. This means that
we will not have any feed-forward and thus, the scalar D is 0.

We now split the transfer function into two factors:

$$\frac{Y(s)}{x_1(s)} \times \frac{x_1(s)}{U(s)} = \frac{s^2+6s+8}{1} \times \frac{1}{s^3+9s^2+23s+15}.$$

We then retrieve the time-domain description,

$$Y(s) = (s^2+6s+8)x_1.$$

$$Y(s) = s^{2} x_1+6s x_1 +8 x_1.$$

$$y(t) = \ddot{x_1} + 6\dot{x_1} +8x_1.$$

We now create two new states that describe all these derivatives. Since
the highest order of the system is 3 (in the denominator of TF), we must
create 2 new states, so that we have 3 states in total.

$$\dot{x_1} = x_2, \dot{x_2} = x_3 = \ddot{x_1}.$$

We substitute the new states into the equation above:

$$y(t) = x_3 + 6x_2 + 8x_1.$$

Now we evaluate the input of the system in a similar manner:

$$U(s) = (s^3+9s^2+23s+15)x_1.$$

$$U(s) = s^3x_1+9s^2x_1+23sx_1+15x_1.$$

$$u(t) = x_1^{(3)}+9\ddot{x_1}+23\dot{x_1}+15x_1.$$

Note that the first term is a third derivative. We can now insert our
new states into the above equation:

$$u(t) = \dot{x_3}+9x_3+23x_2+15x_1.$$

We move the derivative of the third state to the left side and get:

$$\dot{x_3} = -15x_1 - 23x_2 -9x_3 + u.$$

We are now ready to rewrite these equations in the state-space form. We
start by moving the input to the right side of the equation so that we
have an expression for each state.

$\begin{bmatrix}
         \dot{x_1} \\
         \dot{x_2} \\
         \dot{x_3} \\
\end{bmatrix}
=
\begin{bmatrix}
         0 & 1 & 0 \\
         0 & 0 & 1 \\
         -15 & 0-23 & -9 \\
\end{bmatrix}
\times
\begin{bmatrix}
         x_1 \\
         x_2 \\
         x_3 \\
\end{bmatrix}
+
\begin{bmatrix}
         0 \\
         0 \\
         1 \\
\end{bmatrix}
u$

$y =
\begin{bmatrix}
         8 & 6 & 1 \\
\end{bmatrix}
\times
\begin{bmatrix}
         x_1 \\
         x_2 \\
         x_3 \\
\end{bmatrix}
+
\begin{bmatrix}
         0 \\
\end{bmatrix}
u$


# Control Systems/MIMO Systems

## Multi-Input, Multi-Output

Systems with more than one input and/or more than one output are known
as **Multi-Input Multi-Output** systems, or they are frequently known by
the abbreviation **MIMO**. This is in contrast to systems that have only
a single input and a single output (SISO), like we have been discussing
previously.

## State-Space Representation

MIMO systems that are lumped and linear can be described easily with
state-space equations. To represent multiple inputs we expand the input
*u(t)* into a vector *U*(t) with the desired number of inputs. Likewise,
to represent a system with multiple outputs, we expand *y(t)* into
*Y*(t), which is a vector of all the outputs. For this method to work,
the outputs must be linearly dependent on the input vector and the state
vector.

$$X'(t) = AX(t) + BU(t)$$

$$Y(t) = CX(t) + DU(t)$$

### Example: Two Inputs and Two Outputs

## Transfer Function Matrix

If the system is LTI and Lumped, we can take the Laplace Transform of
the state-space equations, as follows:

$$\mathcal{L}[X'(t)] = \mathcal{L}[AX(t)] + \mathcal{L}[BU(t)]$$

$$\mathcal{L}[Y(t)] = \mathcal{L}[CX(t)] + \mathcal{L}[DU(t)]$$

Which gives us the result:

$$s\mathbf{X}(s) - X(0) = A\mathbf{X}(s) + B\mathbf{U}(s)$$

$$\mathbf{Y}(s) = C\mathbf{X}(s) + D\mathbf{U}(s)$$

Where X(0) is the initial conditions of the system state vector in the
time domain. If the system is relaxed, we can ignore this term, but for
completeness we will continue the derivation with it.

We can separate out the variables in the state equation as follows:

$$s\mathbf{X}(s) - A\mathbf{X}(s) = X(0) + B\mathbf{U}(s)$$

Then factor out an **X**(s):

$$\mathbf[sI - A]{X}(s) = X(0) + B\mathbf{U}(s)$$

And then we can multiply both sides by the inverse of *\[sI - A\]* to
give us our state equation:

$$\mathbf{X}(s) = [sI - A]^{-1}X(0) + [sI - A]^{-1}B\mathbf{U}(s)$$

Now, if we plug in this value for **X**(s) into our output equation,
above, we get a more complicated equation:

$$\mathbf{Y}(s) = C([sI - A]^{-1}X(0) + [sI - A]^{-1}B\mathbf{U}(s)) + D\mathbf{U}(s)$$

And we can distribute the matrix **C** to give us our answer:

$$\mathbf{Y}(s) = C[sI - A]^{-1}X(0) + C[sI - A]^{-1}B\mathbf{U}(s) + D\mathbf{U}(s)$$

Now, if the system is relaxed, and therefore *X(0)* is 0, the first term
of this equation becomes 0. In this case, we can factor out a **U**(s)
from the remaining two terms:

$$\mathbf{Y}(s) = (C[sI - A]^{-1}B + D)\mathbf{U}(s)$$

We can make the following substitution to obtain the **Transfer Function
Matrix**, or more simply, the **Transfer Matrix**, **H**(s):

$$C[sI - A]^{-1}B + D = \mathbf{H}(s)$$

And rewrite our output equation in terms of the transfer matrix as
follows:

$$\mathbf{Y}(s) = \mathbf{H}(s)\mathbf{U}(s)$$

If **Y***(s)* and **X***(s)* are *1 × 1* vectors (a SISO system), then
we have our external description:

$$Y(s) = H(s)X(s)$$

Now, since *X(s) =* **X**(s), and *Y(s) =* **Y**(s), then **H**(s) must
be equal to *H(s)*. These are simply two different ways to describe the
same exact equation, the same exact system.

### Dimensions

If our system has *q* inputs, and *r* outputs, our transfer function
matrix will be an *r × q* matrix.

### Relation to Transfer Function

For SISO systems, the Transfer Function matrix will reduce to the
transfer function as would be obtained by taking the Laplace transform
of the system response equation.

For MIMO systems, with *n* inputs and *m* outputs, the transfer function
matrix will contain *n × m* transfer functions, where each entry is the
transfer function relationship between each individual input, and each
individual output.

Through this derivation of the transfer function matrix, we have shown
the equivalency between the Laplace methods and the State-Space method
for representing systems. Also, we have shown how the Laplace method can
be generalized to account for MIMO systems. Through the rest of this
explanation, we will use the Laplace and State Space methods
interchangeably, opting to use one or the other where appropriate.

### Zero-State and Zero-Input

If we have our complete system response equation from above:

$$\mathbf{Y}(s) = C[sI - A]^{-1}\mathbf{x}(0) + (C[sI - A]^{-1}B + D)\mathbf{U}(s)$$

We can separate this into two separate parts:

-   $C[sI - A]^{-1}X(0)$ The **Zero-Input Response**.
-   $(C[sI - A]^{-1}B + D)\mathbf{U}(s)$ The **Zero-State Response**.

These are named because if there is no input to the system (zero-input),
then the output is the response of the system to the initial system
state. If there is no state to the system, then the output is the
response of the system to the system input. The complete response is the
sum of the system with no input, and the input with no state.

## Discrete MIMO Systems

In the discrete case, we end up with similar equations, except that the
*X*(0) initial conditions term is preceded by an additional *z*
variable:

$$\mathbf{X}(z) = [zI - A]^{-1}zX(0) + [zI - A]^{-1}B\mathbf{U}(z)$$

$$\mathbf{Y}(z) = C[zI - A]^{-1}zX(0) + C[zI - A]^{-1}B\mathbf{U}(z) + D\mathbf{U}(z)$$

If *X*(0) is zero, that term drops out, and we can derive a Transfer
Function Matrix in the Z domain as well:

$$\mathbf{Y}(z) = (C[zI - A]^{-1}B + D)\mathbf{U}(z)$$

$$C[zI - A]^{-1}B + D = \mathbf{H}(z)$$

$$\mathbf{Y}(z) = \mathbf{H}(z)\mathbf{U}(z)$$

{{-}}

### Example: Pulse Response

## Controller Design

The controller design for MIMO systems is more extensive and thus more
complicated than for SISO system. Ackermann\'s formula, the typical full
state feedback design for
SISO system, could not be used for MIMO systems because the additional
inputs lead to an overdetermined system. This means, in case of MIMO
systems, the feedback matrix *K* is **not unique**.

Approaches for the controller design are stated in Section Eigenvalue
Assignment for MIMO
Systems.


# Control Systems/Realizations

## Realization

**Realization** is the process of taking a mathematical model of a
system (either in the Laplace domain or the State-Space domain), and
creating a physical system. Some systems are not realizable.

An important point to keep in mind is that the Laplace domain
representation, and the state-space representations are equivalent, and
both representations describe the same physical systems. We want,
therefore, a way to convert between the two representations, because
each one is well suited for particular methods of analysis.

The state-space representation, for instance, is preferable when it
comes time to move the system design from the drawing board to a
constructed physical device. For that reason, we call the process of
converting a system from the Laplace representation to the state-space
representation \"realization\".

## Realization Conditions

-   A transfer function *G(s)* is realizable if and only if the system
    can be described by a finite-dimensional state-space equation.
-   *(A B C D)*, an ordered set of the four system matrices, is called a
    **realization** of the system *G(s)*. If the system can be expressed
    as such an ordered quadruple, the system is realizable.
-   A system *G* is realizable if and only if the transfer matrix
    **G**(s) is a proper rational matrix. In other words, every entry in
    the matrix **G**(s) (only 1 for SISO systems) is a rational
    polynomial, and if the degree of the denominator is higher or equal
    to the degree of the numerator.

We\'ve already covered the method for realizing a SISO system, the
remainder of this chapter will talk about the general method of
realizing a MIMO system.

## Realizing the Transfer Matrix

We can decompose a transfer matrix **G**(s) into a *strictly proper*
transfer matrix:

$$\mathbf{G}(s) = \mathbf{G}(\infty) + \mathbf{G}_{sp}(s)$$

Where G~sp~(s) is a strictly proper transfer matrix. Also, we can use
this to find the value of our *D* matrix:

$$D = \mathbf{G}(\infty)$$

We can define *d(s*) to be the lowest common denominator polynomial of
all the entries in **G**(s):

$$d(s) = s^r + a_1s^{r-1} + \cdots + a_{r-1}s + a_r$$

Then we can define **G**~sp~ as:

$$\mathbf{G}_{sp}(s) = \frac{1}{d(s)}N(s)$$

Where

$$N(s) = N_1s^{r-1} + \cdots + N_{r-1}s + N_r$$

And the *N~i~* are *p × q* constant matrices.

If we remember our method for converting a transfer function to a
state-space equation, we can follow the same general method, except that
the new matrix *A* will be a block matrix, where each block is the size
of the transfer matrix:

$$A = \begin{bmatrix}
                   -a_1I_p & -a_2I_p & \cdots & -a_{r-1}I_p & -a_rI_p \\
                   I_p     & 0       & \cdots & 0           & 0 \\
                   0       & I_p     & \cdots & 0           & 0 \\
                   \vdots  & \vdots  & \ddots & \vdots      & \vdots \\
                   0       & 0       & \cdots & I_p         & 0
           \end{bmatrix}$$

$$B = \begin{bmatrix}I_p \\ 0 \\ 0 \\ \vdots \\ 0 \end{bmatrix}$$

$$C = \begin{bmatrix}N_1 & N_2 & N_3 & \cdots & Nr\end{bmatrix}$$

### Realizing System by Column

We can divide the **G(s)** into multiple column, realize them
individually and join them back together later, for **G(s)**:

$G(s) =\begin{bmatrix} G_1 & G_2 & G_3 &\dots & G_n \end{bmatrix}$

where we realize them and yield:

$G_i => (A_i,B_i,C_i,D_i)$

and the realization of the system will be:

$A  = \begin{bmatrix}
A_1 & 0 & 0 & \dots &0\\
0 & A_2 & 0&&\vdots\\
0 & 0 & A_3\\
\vdots& & & \ddots &0\\
0&0&0&\dots &A_n
\end{bmatrix}$

$B  = \begin{bmatrix}
B_1 & 0 & 0 & \dots &0\\
0 & B_2 & 0&&\vdots\\
0 & 0 & B_3\\
\vdots& & & \ddots &0\\
0&0&0&\dots &B_n
\end{bmatrix}$

$C = \begin{bmatrix} C_1 & C_2 & C_3 &\dots& C_n \end{bmatrix}$

$D = \begin{bmatrix} D_1 & D_2 & D_3 &\dots& D_n \end{bmatrix}$


# Control Systems/Gain

## What is Gain?

**Gain** is a proportional value that shows the relationship between the
magnitude of the input to the magnitude of the output signal at steady
state. Many systems contain a method by which the gain can be altered,
providing more or less \"power\" to the system. However, increasing gain
or decreasing gain beyond a particular safety zone can cause the system
to become unstable.

Consider the given second-order system:

$$T(s) = \frac{1}{s^2 + 2s + 1}$$

We can include an arbitrary gain term, K in this system that will
represent an amplification, or a power increase:

$$T(s) = K\frac{1}{s^2 + 2s + 1}$$

In a state-space system, the gain term *k* can be inserted as follows:

$$x'(t) = Ax(t) + kBu(t)$$

$$y(t) = Cx(t) + kDu(t)$$

The gain term can also be inserted into other places in the system, and
in those cases the equations will be slightly different.

![](Gain_Block.svg "Gain_Block.svg"){width="400"}

### Example: Gain

## Responses to Gain

As the gain to a system increases, generally the rise-time decreases,
the percent overshoot increases, and the settling time increases.
However, these relationships are not always the same. A **critically
damped system**, for example, may decrease in rise time while not
experiencing any effects of percent overshoot or settling time.

## Gain and Stability

If the gain increases to a high enough extent, some systems can become
unstable. We will examine this effect in the chapter on **Root Locus**.
But it will decrease the steady state error.

### Conditional Stability

Systems that are stable for some gain values, and unstable for other
values are called **conditionally stable** systems. The stability is
conditional upon the value of the gain, and often the threshold where
the system becomes unstable is important to find.


# Control Systems/Block Diagrams

When designing or analyzing a system, often it is useful to model the
system graphically. **Block Diagrams** are a useful and simple method
for analyzing a system graphically. A \"block\" looks on paper exactly
what it means:

## Systems in Series

When two or more systems are in series, they can be combined into a
single representative system, with a transfer function that is the
product of the individual systems.

![](Time_Series_Block.svg "Time_Series_Block.svg")

If we have two systems, *f(t)* and *g(t)*, we can put them in series
with one another so that the output of system *f(t)* is the input to
system *g(t)*. Now, we can analyze them depending on whether we are
using our classical or modern methods.

If we define the output of the first system as *h(t)*, we can define
*h(t)* as:

$$h(t) = x(t) * f(t)$$

Now, we can define the system output *y(t)* in terms of *h(t)* as:

$$y(t) = h(t) * g(t)$$

We can expand *h(t)*:

$$y(t) = [x(t) * f(t)] * g(t)$$

But, since convolution is associative, we can re-write this as:

$$y(t) = x(t) * [f(t) * g(t)]$$

Our system can be simplified therefore as such:

![](Time_Convolution_Block.svg "Time_Convolution_Block.svg")

### Series Transfer Functions

If two or more systems are in series with one another, the total
transfer function of the series is the product of all the individual
system transfer functions.

![](S-Domain_Series_Block.svg "S-Domain_Series_Block.svg")

In the time-domain we know that:

$$y(t) = x(t) * [f(t) * g(t)]$$

But, in the frequency domain we know that convolution becomes
multiplication, so we can re-write this as:

$$Y(s) = X(s)[F(s)G(s)]$$

We can represent our system in the frequency domain as:

![](S-Domain_Multiplication_Block.svg "S-Domain_Multiplication_Block.svg")

### Series State Space

If we have two systems in series (say system F and system G), where the
output of F is the input to system G, we can write out the state-space
equations for each individual system.

System 1:

$$x_F' = A_Fx_F + B_Fu$$

$$y_F = C_Fx_F + D_Fu$$

System 2:

$$x_G' = A_Gx_G + B_Gy_F$$

$$y_G = C_Gx_G + D_Gy_F$$

And we can write substitute these equations together form the complete
response of system H, that has input u, and output y~G~:

$$\begin{bmatrix}x_G' \\ x_F'\end{bmatrix}
     = \begin{bmatrix}A_G & B_GC_F \\ 0 & A_F\end{bmatrix}
       \begin{bmatrix}x_G \\ x_F\end{bmatrix} +
       \begin{bmatrix}B_GD_F \\ B_F\end{bmatrix}u$$

$$\begin{bmatrix}y_G \\ y_F\end{bmatrix}
     = \begin{bmatrix}C_G & D_GC_F \\ 0 & C_F\end{bmatrix}
       \begin{bmatrix}x_G \\ x_F\end{bmatrix} +
       \begin{bmatrix}D_GD_F \\ D_F\end{bmatrix}u$$

## Systems in Parallel

![](S-Domain_Parallel_Block.svg "S-Domain_Parallel_Block.svg")

Blocks may not be placed in parallel without the use of an adder. Blocks
connected by an adder as shown above have a total transfer function of:

$$Y(s) = X(s) [F(s) + G(s)]$$

Since the Laplace transform is linear, we can easily transfer this to
the time domain by converting the multiplication to convolution:

$$y(t) = x(t) * [f(t) + g(t)]$$

![](S-Domain_Addition_Block.svg "S-Domain_Addition_Block.svg")

## State Space Model

The state-space equations, with non-zero A, B, C, and D matrices
conceptually model the following system:

![](Typical_State_Space_Model_(General).svg "Typical_State_Space_Model_(General).svg")

In this image, the strange-looking block in the center is either an
integrator or an ideal delay, and can be represented in the transfer
domain as:

$$\frac{1}{s}$$ or $\frac{1}{z}$

Depending on the time characteristics of the system. If we only consider
continuous-time systems, we can replace the funny block in the center
with an integrator:

![](Typical_State_Space_Model_(CT).svg "Typical_State_Space_Model_(CT).svg")

### In the Laplace Domain

The state space model of the above system, if *A*, *B*, *C*, and *D* are
transfer functions *A(s)*, *B(s)*, *C(s)* and *D(s)* of the individual
subsystems, and if *U(s)* and *Y(s)* represent a single input and
output, can be written as follows:

$$\frac{Y(s)}{U(s)} = B(s)\left(\frac{1}{s - A(s)}\right)C(s) + D(s)$$

We will explain how we got this result, and how we deal with feedforward
and feedback loop structures in the next chapter.

## Adders and Multipliers

Some systems may have dedicated summation or multiplication devices,
that automatically add or multiply the transfer functions of multiple
systems together

## Simplifying Block Diagrams

Block diagrams can be systematically simplified. Note that this table is
from Schaum\'s Outline: Feedback and Controls Systems by DiStefano et al

  Transformation                                                                                Equation                                                Block Diagram                        Equivalent Block Diagram
  --------------------------------------------------------------------------------------------------- ------------------------------------------------------- ------------------------------------ -----------------------------------------------------------------------------------------------------------------------------------------
  1                                                                                Cascaded Blocks                                         $Y=\left(P_1 P_2 \right) X$          image:Cascaded Blocks.svg
  2                                                                                Combining Blocks in Parallel                            $Y=P_1 X \pm P_2 X$                  image:Parallel Blocks.svg
  3                                                                                Removing a Block from a Forward Loop                    $Y=P_1 X \pm P_2 X$                  image:Parallel Blocks Equivalent 2.svg
  4                                                                                Eliminating a Feedback Loop                             $Y=P_1 \left( X \mp P_2 Y \right)$   image:Feedback Loop.svg
  5                                                                                Removing a Block from a Feedback Loop                   $Y=P_1 \left( X \mp P_2 Y \right)$   image:Feedback Loop Equivalent 2.svg
  6                                                                                Rearranging Summing Junctions                           $Z=W \pm X \pm Y$                    image:Rearranging Summing Junctions 1.svg
  image:Rearranging Summing Junctions 3.svg
  7                                                                                Moving a Summing Junction in front of a Block           $Z = P X \pm Y$                      image:Moving Summing Junction in front of Block 1.svg
  8                                                                                Moving a Summing Junction beyond a Block                $Z = P \left( X \pm Y \right)$       ![](Moving_Summing_Junction_beyond_Block_1.svg "Moving_Summing_Junction_beyond_Block_1.svg")
  9                                                                                Moving a Takeoff Point in front of a Block              $Y= PX\,$                            image:Moving Takeoff Point in front of Block 1.svg
  10                                                                                Moving a Takeoff Point beyond a Block                   $Y=PX\,$                             image:Moving Takeoff Point beyond Block 1.svg
  11                                                                                Moving a Takeoff Point in front of a Summing Junction   $Z=W \pm X$                          image:Moving Takeoff Point ahead of a Summing Junction 1.svg
  12                                                                                Moving a Takeoff Point beyond a Summing Junction        $Z=X \pm Y$                          file:Moving Takeoff Point beyond a Summing Junction 1.svg

## External links

-   SISO Block Diagram with transfer functions on
    ControlTheoryPro.com


# Control Systems/Feedback Loops

## Feedback

A **feedback loop** is a common and powerful tool when designing a
control system. Feedback loops take the system output into
consideration, which enables the system to adjust its performance to
meet a desired output response.

When talking about control systems it is important to keep in mind that
engineers typically are given existing systems such as actuators,
sensors, motors,
and other devices with set parameters, and are asked to adjust the
performance of those systems. In many cases, it may not be possible to
open the system (the \"plant\") and adjust it from the inside:
modifications need to be made external to the system to force the system
response to act as desired. This is performed by adding controllers,
compensators, and feedback structures to the system.

## Basic Feedback Structure

center\|framed
 This is a basic feedback structure.
Here, we are using the output value of the system to help us prepare the
next output value. In this way, we can create systems that correct
errors. Here we see a feedback loop with a value of one. We call this a
**unity feedback**.

**Here is a list of some relevant vocabulary, that will be used in the
following sections:**

Plant:The term \"Plant\" is a carry-over term from chemical engineering to refer to the main system process. The plant is the preexisting system that does not (without the aid of a controller or a compensator) meet the given specifications. Plants are usually given \"as is\", and are not changeable. In the picture above, the plant is denoted with a P.\
Controller:A controller, or a \"compensator\" is an additional system that is added to the plant to control the operation of the plant. The system can have multiple compensators, and they can appear anywhere in the system: Before the pick-off node, after the summer, before or after the plant, and in the feedback loop. In the picture above, our compensator is denoted with a C.

Summer:A summer is a symbol on a system diagram, (denoted above with parenthesis) that conceptually adds two or more input signals, and produces a single sum output signal.\
Pick-off node:A pickoff node is simply a fancy term for a split in a wire.\
Forward Path:The forward path in the feedback loop is the path after the summer, that travels through the plant and towards the system output.\
Reverse Path:The reverse path is the path after the pick-off node, that loops back to the beginning of the system. This is also known as the \"feedback path\".\
Unity feedback:When the multiplicative value of the feedback path is 1.

## Negative vs Positive Feedback

It turns out that negative feedback is almost always the most useful
type of feedback. When we subtract the value of the output from the
value of the input (our desired value), we get a value called the
**error signal**. The error signal shows us how far off our output is
from our desired input.

Positive feedback has the property that signals tend to reinforce
themselves, and grow larger. In a positive feedback system, noise from
the system is added back to the input, and that in turn produces more
noise. As an example of a positive feedback system, consider an audio
amplification system with a speaker and a microphone. Placing the
microphone near the speaker creates a positive feedback loop, and the
result is a sound that grows louder and louder. Because the majority of
noise in an electrical system is high-frequency, the sound output of the
system becomes high-pitched.

### Example: State-Space Equation

{1 - \\frac{1}{s}A} = \\frac{1}{s - A}`</math>`{=html}

Pre-multiplying by the factor B, and post-multiplying by C, we get the
transfer function of the entire lower-half of the loop:

$$T_{lower}(s) = B\left(\frac{1}{s - A}\right)C$$

We can see that the upper path (D) and the lower-path T~lower~ are added
together to produce the final result:

$$T_{total}(s) = B\left(\frac{1}{s - A}\right)C + D$$

Now, for an alternate method, we can assume that **x**\' is the value of
the inner-feedback loop, right before the integrator. This makes sense,
since the integral of **x**\' should be **x** (which we see from the
diagram that it is. Solving for **x**\', with an input of **u**, we get:

$$x' = Ax + Bu$$

This is because the value coming from the feedback branch is equal to
the value **x** times the feedback loop matrix A, and the value coming
from the left of the summer is the input **u** times the matrix B.

If we keep things in terms of **x** and **u**, we can see that the
system output is the sum of **u** times the feed-forward value D, and
the value of **x** times the value C:

$$y = Cx + Du$$

These last two equations are precisely the state-space equations of our
system.}}

## Feedback Loop Transfer Function

We can solve for the output of the system by using a series of
equations:

$$E(s) = X(s) - Y(s)$$

$$Y(s) = G(s)E(s)$$

and when we solve for Y(s) we get:

$$Y(s) =  X(s) \frac{Gp(s)}{1 + Gp(s)}$$

The reader is encouraged to use the above equations to derive the result
by themselves.

The function E(s) is known as the **error signal**. The error signal is
the difference between the system output (Y(s)), and the system input
(X(s)). Notice that the error signal is now the direct input to the
system G(s). X(s) is now called the **reference input**. The purpose of
the negative feedback loop is to make the system output equal to the
system input, by identifying large differences between X(s) and Y(s) and
correcting for them.

### Example: Elevator

Here is a simple example of reference inputs and feedback systems:

### State-Space Feedback Loops

In the state-space representation, the plant is typically defined by the
state-space equations:

$$x'(t) = Ax(t) + Bu(t)$$

$$y(t) = Cx(t) + Du(t)$$

The plant is considered to be pre-existing, and the matrices A, B, C,
and D are considered to be internal to the plant (and therefore
unchangeable). Also, in a typical system, the state variables are either
fictional (in the sense of dummy-variables), or are not measurable. For
these reasons, we need to add external components, such as a gain
element, or a feedback element to the plant to enhance performance.

Consider the addition of a gain matrix K installed at the input of the
plant, and a negative feedback element F that is multiplied by the
system output *y*, and is added to the input signal of the plant. There
are two cases:

1.  The feedback element F is subtracted from the input before
    multiplication of the K gain matrix.
2.  The feedback element F is subtracted from the input after
    multiplication of the K gain matrix.

In case 1, the feedback element F is added to the input before the
multiplicative gain is applied to the input. If *v* is the input to the
entire system, then we can define *u* as:

$$u(t) =  Fv(t) - FKy(t)$$

In case 2, the feeback element F is subtracted from the input after the
multiplicative gain is applied to the input. If *v* is the input to the
entire system, then we can define *u* as:

$$u(t) = Kv(t) - Fy(t)$$

## Open Loop vs Closed Loop

![](System_3_KGpGb.png "System_3_KGpGb.png"){width="600"}

Let\'s say that we have the generalized system shown above. The top
part, Gp(s) represents all the systems and all the controllers on the
forward path. The bottom part, Gb(s) represents all the feedback
processing elements of the system. The letter \"K\" in the beginning of
the system is called the **Gain**. We will talk about the gain more in
later chapters. We can define the **Closed-Loop Transfer Function** as
follows:

$$H_{cl}(s) =  \frac{KGp(s)}{1 + Gp(s)Gb(s)}$$

If we \"open\" the loop, and break the feedback node, we can define the
**Open-Loop Transfer Function**, as:

$$H_{ol}(s) = KGp(s)$$

We can redefine the closed-loop transfer function in terms of this
open-loop transfer function:

$$H_{cl}(s) = \frac{H_{ol}(s)}{1 +Gp(s)Gb(s)}$$

These results are important, and they will be used without further
explanation or derivation throughout the rest of the book.

## Placement of a Controller

There are a number of different places where we could place an
additional controller.

:   {\| class=\"wikitable\"

\|- \|![](System_5_Positions.png "System_5_Positions.png"){width="400"}
\|- \|

1.  In front of the system, before the feedback loop.
2.  Inside the feedback loop, in the forward path, before the plant.
3.  In the forward path, after the plant.
4.  In the feedback loop, in the reverse path.
5.  After the feedback loop.

\|}

Each location has certain benefits and problems, and hopefully we will
get a chance to talk about all of them.

## Second-Order Systems

The general expression of the transfer function of a second order system
is given as:

$\frac{\omega_n^2}{s^2 + 2\zeta\omega_ns + \omega_n^2}$

where $\zeta$ and $\omega_n$ are damping ratio and natural frequency of
the system respectively.

### Damping Ratio

The damping ratio is defined by way of the sign $\zeta$. The damping
ratio gives us an idea about the nature of the transient response
detailing the amount of overshoot & oscillation that the system will
undergo. This is completely regardless of time scaling.

If :

-   $\zeta$ = zero, the system is undamped;
-   $\zeta$ \< 1, the system is underdamped;
-   $\zeta$ = 1, the system is critically damped;
-   $\zeta$ \> 1, the system is overdamped.

$\zeta$ is used in conjunction with the natural frequency to determine
system properties. To find the zeta value you must first find the
natural response!

### Natural Frequency

Natural Frequency, denoted by $\omega_n$ is defined as the frequency
with which the system would oscillate if it were not damped and we
define the damping ratio as $\zeta = \frac{\sigma}{\omega_n}$.

## System Sensitivity


# Control Systems/Signal Flow Diagrams

## Signal-flow graphs

**Signal-flow graphs** are another method for visually representing a
system. Signal Flow Diagrams are especially useful, because they allow
for particular methods of analysis, such as **Mason\'s Gain Formula**.

Signal flow diagrams typically use curved lines to represent wires *and
systems*, instead of using lines at right-angles, and boxes,
respectively. Every curved line is considered to have a multiplier
value, which can be a constant gain value, or an entire transfer
function. Signals travel from one end of a line to the other, and lines
that are placed in series with one another have their total multiplier
values multiplied together (just like in block diagrams).

Signal flow diagrams help us to identify structures called \"loops\" in
a system, which can be analyzed individually to determine the complete
response of the system.

!An example of a signal flow
diagram.

### Forward Paths

A **forward path** is a path in the signal flow diagram that connects
the input to the output without touching any single node or path more
than once. A single system can have multiple forward paths.

### Loops

A **loop** is a structure in a signal flow diagram that leads back to
itself. A loop does not contain the beginning and ending points, and the
end of the loop is the same node as the beginning of a loop.

Loops are said to touch if they share a node or a line in common.

The **Loop gain** is the total gain of the loop, as you travel from one
point, around the loop, back to the starting point.

### Delta Values

The Delta value of a system, denoted with a Greek Δ is computed as
follows:

$$\Delta = 1 - A + B - C + D - E + F......+ \infty$$

Where:

-   A is the sum of all individual loop gains
-   B is the sum of the products of all the pairs of non-touching loops
-   C is the sum of the products of all the sets of 3 non-touching loops
-   D is the sum of the products of all the sets of 4 non-touching loops
-   et cetera.

If the given system has no pairs of loops that do not touch, for
instance, B and all additional letters after B will be zero.

### Mason\'s Rule

**Mason\'s rule** is a rule for determining the gain of a system.
Mason\'s rule can be used with block diagrams, but it is most commonly
(and most easily) used with signal flow diagrams.

If we have computed our delta values (above), we can then use **Mason\'s
Gain Rule** to find the complete gain of the system:

$$M = \frac{y_{out}}{y_{in}} = \sum_{k=1}^N \frac{M_k \Delta\ _k}{ \Delta\ }$$

Where M is the total gain of the system, represented as the ratio of the
output gain (y~out~) to the input gain (y~in~) of the system. M~k~ is
the gain of the k^th^ forward path, and Δ~k~ is the loop gain of the
k^th^ loop.

## Examples

### Solving a signal-flow graph by systematic reduction : Two interlocking loops

This example shows how a system of five equations in five unknowns is
solved using systematic reduction rules. The independent variable is
$x_{in}$. The dependent variables are $x_1$, $x_2$, $x_3$, $x_4$,
$x_{out}$. The coefficients are labeled $a, b, c, d, e$. Here is the
starting flowgraph:
frameless\|upright=2

$$\begin{align}
 x_1 &= x_\mathrm{in}+e x_3  \\
 x_2 &= b x_1+a x_4  \\
 x_3 &= c x_2 \\
 x_4 &= d x_3 \\
 x_\mathrm{out} &= x_4 \\
\end{align}$$

The steps for solving $x_{out}$ follow.

#### Removing edge c from x2 to x3

frameless\|upright=2

$$\begin{align}
 x_1 &= x_\mathrm{in}+e x_3  \\
 x_2 &= b x_1+a x_4  \\
 x_3 &= c x_2 \\
 x_3 &= c (b x_1+a x_4) \\
 x_3 &= bc x_1+ca x_4 \\
 x_4 &= d x_3 \\
 x_\mathrm{out} &= x_4 \\
\end{align}$$
frameless\|upright=2

#### Removing node x2 and its inflows

$x_2$ has no outflows, and is not a node of interest.
frameless\|upright=2
frameless\|upright=2

#### Removing edge e from x3 to x1

frameless\|upright=2

$$\begin{align}
 x_1 &= x_\mathrm{in}+e x_3  \\
 x_1 &= x_\mathrm{in}+e (bc x_1+ca x_4)  \\
 x_1 &= x_\mathrm{in}+ bce x_1+ ace x_4  \\
 x_2 &= b x_1+a x_4  \\
 x_3 &= bc x_1+ca x_4 \\
 x_4 &= d x_3 \\
 x_\mathrm{out} &= x_4 \\
\end{align}$$
frameless\|upright=2

#### Remove edge d from x3 to x4

frameless\|upright=2

$$\begin{align}
 x_1 &= x_\mathrm{in}+ace x_4 + bce x_1 \\
 x_3 &= bc x_1+ac x_4 \\
 x_4 &= d x_3 \\
 x_4 &= d (bc x_1+ac x_4) \\
 x_4 &= bcd x_1 + acd x_4 \\
 x_\mathrm{out} &= x_4 \\
\end{align}$$

Node $x_3$ has no outflows and is not a node of interest. It is deleted
along with its inflows.

$$\begin{align}
 x_1 &= x_\mathrm{in}+ace x_4 + bce x_1 \\
 x_4 &= bcd x_1 + acd x_4 \\
 x_\mathrm{out} &= x_4 \\
\end{align}$$
frameless\|upright=2

#### Removing self-loop at x1

frameless\|upright=2

$$\begin{align}
 x_1 &= x_\mathrm{in}+ace x_4 + bce x_1 \\
 x_1 (1-bce) &= x_\mathrm{in}+ace x_4  \\
 x_1  &= \frac{1}{1-bce}x_\mathrm{in}+\frac{ace}{1-bce} x_4   \\
 x_4 &= bcd x_1 + acd x_4 \\
 x_\mathrm{out} &= x_4 \\
\end{align}$$
frameless\|upright=2

#### Removing self-loop at x4

frameless\|upright=2

$$\begin{align}
 x_1  &= \frac{1}{1-bce}x_\mathrm{in}+\frac{ace}{1-bce} x_4   \\
 x_4 &= bcd x_1 + acd x_4 \\
 x_4 (1-acd) &= bcd x_1 \\
 x_4  &= \frac{bcd}{1-acd} x_1 \\
 x_\mathrm{out} &= x_4 \\
\end{align}$$
frameless\|upright=2

#### Remove edge from x4 to x1

frameless\|upright=2

$$\begin{align}
 x_1  &= \frac{1}{1-bce}x_\mathrm{in}+\frac{ace}{1-bce} x_4   \\
 x_1  &= \frac{1}{1-bce}x_\mathrm{in}+\frac{ace}{1-bce} \times \frac{bcd}{1-acd} x_1   \\
 x_4  &= \frac{bcd}{1-acd} x_1 \\
 x_\mathrm{out} &= x_4 \\
\end{align}$$

#### Remove outflow from x4 to x~out~

$$\begin{align}
 x_1  &= \frac{1}{1-bce}x_\mathrm{in}+\frac{ace}{1-bce} \times \frac{bcd}{1-acd} x_1   \\
 x_\mathrm{out}  &= \frac{bcd}{1-acd} x_1 \\
\end{align}$$ $x_4$\'s outflow is then eliminated: $x_\mathrm{out}$ is
connected directly to $x_1$ using the product of the gains from the two
edges replaced.

$x_4$ is not a variable of interest; thus, its node and its inflows are
eliminated.

frameless\|upright=2

#### Eliminating self-loop at x1

$$\begin{align}
 x_1  &= \frac{1}{1-bce}x_\mathrm{in}+\frac{ace}{1-bce} \times \frac{bcd}{1-acd} x_1   \\
 x_1  (1-\frac{ace}{1-bce} \times \frac{bcd}{1-acd}) &= \frac{1}{1-bce}x_\mathrm{in}    \\
 x_1   &= \frac{1}{(1-bce) \times (1-\frac{ace}{1-bce} \times \frac{bcd}{1-acd}) }x_\mathrm{in}    \\
 x_\mathrm{out}  &= \frac{bcd}{1-acd} x_1 \\
\end{align}$$
frameless\|upright=2
frameless\|upright=2

#### Eliminating outflow from x1, then eliminating x1 and its inflows

frameless\|upright=2

$$\begin{align}
 x_1   &= \frac{1}{(1-bce) \times (1-\frac{ace}{1-bce} \times \frac{bcd}{1-acd}) }x_\mathrm{in}    \\
 x_\mathrm{out}  &= \frac{bcd}{1-acd} x_1 \\
 x_\mathrm{out}  &= \frac{bcd}{1-acd} \times \frac{1}{(1-bce) \times (1-\frac{ace}{1-bce} \times \frac{bcd}{1-acd}) }x_\mathrm{in} \\
\end{align}$$ $x_1$ is not a variable of interest; $x_1$ and its inflows
are eliminated

$$\begin{align}
 x_\mathrm{out}  &= \frac{bcd}{1-acd} \times \frac{1}{(1-bce) \times (1-\frac{ace}{1-bce} \times \frac{bcd}{1-acd}) }x_\mathrm{in} \\
\end{align}$$
frameless\|upright=2

#### Simplifying the gain expression

$\begin{align}
x_\mathrm{out}  &= \frac{-bcd}{bce+acd-1} x_\mathrm{in} \\
\end{align}$

frameless\|upright=2

### Solving a signal-flow graph by systematic reduction: Three equations in three unknowns

This example shows how a system of three equations in three unknowns is
solved using systematic reduction rules. The independent variables are
$y_1$, $y_2$, $y_3$. The dependent variables are $x_1$, $x_2$, $x_3$.
The coefficients are labeled $c_{jk}$. The steps for solving $x_1$
follow:
frameless\|upright=2
frameless\|upright=2
frameless\|upright=2
frameless\|upright=2
frameless\|upright=2
frameless\|upright=2
frameless\|upright=2
frameless\|upright=2
frameless\|upright=2
frameless\|upright=2
frameless\|upright=2
frameless\|upright=2
frameless\|upright=2

## Electrical engineering: Construction of a flow graph for a RC circuit

![](AC_Source-R-C.svg "AC_Source-R-C.svg")

This illustration shows the physical connections of the circuit.
Independent voltage source S is connected in series with a resistor R
and capacitor C. The example is developed from the physical circuit
equations and solved using signal-flow graph techniques. Polarity is
important:

-   S is a source with the positive terminal at **N~1~** and the
    negative terminal at **N~3~**
-   R is a resistor with the positive terminal at **N~1~** and the
    negative terminal at **N~2~**
-   C is a capacitor with the positive terminal at **N~2~** and the
    negative terminal at **N~3~**.

The unknown variable of interest is the voltage across capacitor **C**.

Approach to the solution:

-   Find the set of equations from the physical network. These equations
    are acausal in nature.
    -   Branch equations for the capacitor and resistor. The equations
        will be developed as transfer functions using Laplace
        transforms.
    -   Kirchhoff\'s voltage and current laws
-   Build a signal-flow graph from the equations.
-   Solve the signal-flow graph.

### Branch equations

![](AC_Source-R-C-Branches.svg "AC_Source-R-C-Branches.svg") The branch
equations are shown for R and C.

#### Resistor R (Branch equation $B_R$)

The resistor\'s branch equation in the time domain is:

$$V_R(t) = R I_R(t)$$ In the Laplace-transformed signal space:

$$V_R(s) = R I_R(s)$$

#### Capacitor C (Branch equation $B_C$)

The capacitor\'s branch equation in the time domain is:

$$V_C(t) = \frac{Q_C(t)}{C} = \frac{1}{C}\int_{t_0}^t I_C(\tau) \mathrm{d}\tau + V_C(t_0)$$
Assuming the capacitor is initially discharged, the equation becomes:

$$V_C(t) = \frac{Q_C(t)}{C} = \frac{1}{C}\int_{t_0}^t I_C(\tau) \mathrm{d}\tau$$
Taking the derivative of this and multiplying by *C* yields the
derivative form:

$$I_C(t) = \frac{\mathrm{d}Q(t)}{\mathrm{d}t} = C\frac{\mathrm{d}V_C(t)}{\mathrm{d}t}$$
In the Laplace-transformed signal space:

$$I_C(s) = V_C(s) sC$$

### Kirchhoff\'s laws equations

![](AC_Source-R-C-KCL-KVL.svg "AC_Source-R-C-KCL-KVL.svg")

#### Kirchhoff\'s Voltage Law equation $\mathrm{KVL}_1$

This circuit has only one independent loop. Its equation in the time
domain is:

$$V_R(t) + V_C(t) - V_S (t) =0$$ In the Laplace-transformed signal
space:

$$V_R(s) + V_C(s) - V_S (s) =0$$

#### Kirchhoff\'s Current Law equations $\mathrm{KCL}_1, {KCL}_2, {KCL}_3$

The circuit has three nodes, thus three Kirchhoff\'s current equations
(expresses here as the currents flowing from the nodes):

:   `<math>`{=html}

\\begin{align} I_S(t) + I_R (t) & = 0 & & \\mathrm{(KCL_1)} \\\\
I_C(t) - I_R (t) & = 0 & & \\mathrm{(KCL_2)} \\\\ I_S(t) - I_C (t) & = 0
& & \\mathrm{(KCL_3)} \\\\ \\end{align} `</math>`{=html} In the
Laplace-transformed signal space:

:   `<math>`{=html}

\\begin{align} I_S(s) + I_R (s) & = 0 & & \\mathrm{(KCL_1)} \\\\
I_C(s) - I_R (s) & = 0 & & \\mathrm{(KCL_2)} \\\\ I_S(s) - I_C (s) & = 0
& & \\mathrm{(KCL_3)} \\\\ \\end{align} `</math>`{=html} A set of
independent equations must be chosen. For the current laws, it is
necessary to drop one of these equations. In this example, let us choose
$\mathrm{KCL}_1, {KCL}_2$.

### Building the signal-flow graph

We then look at the inventory of equations, and the signals that each
equation relates:

  Equation           Signals
  ------------------ --------------------------
  $\mathrm{B_C}$     $\mathrm{V_C, I_C}$
  $\mathrm{B_R}$     $\mathrm{V_R, I_R}$
  $\mathrm{KVL}_1$   $\mathrm{V_R, V_C, V_S}$
  $\mathrm{KCL}_1$   $\mathrm{I_S, I_R}$
  $\mathrm{KCL}_2$   $\mathrm{I_R, I_C}$

The next step consists in assigning to each equation a signal that will
be represented as a node. Each independent source signal is represented
in the signal-flow graph as a source node, therefore no equation is
assigned to the independent source $\mathrm{V_S}$. There are many
possible valid signal flow graphs from this set of equations. An
equation must only be used once, and the variables of interest must be
represented.

  Equation           Signals                    Assigned signal node
  ------------------ -------------------------- ----------------------
  $\mathrm{B_C}$     $\mathrm{V_C, I_C}$        $\mathrm{I_C}$
  $\mathrm{B_R}$     $\mathrm{V_R, I_R}$        $\mathrm{V_R}$
  $\mathrm{KVL}_1$   $\mathrm{V_R, V_C, V_S}$   $\mathrm{V_C}$
  $\mathrm{KCL}_1$   $\mathrm{I_S, I_R}$        $\mathrm{I_S}$
  $\mathrm{KCL}_2$   $\mathrm{I_R, I_C}$        $\mathrm{I_R}$

### The resulting flow graph is then drawn

![](AC_Source-R-C-SFG.svg "AC_Source-R-C-SFG.svg")

The next step consists in solving the signal-flow graph.

Using either Mason or systematic reduction, the resulting signal flow
graph is:\
![](AC_Source-R-C-SFG-Solved-V_C.svg "AC_Source-R-C-SFG-Solved-V_C.svg")

### Mechatronics example

thumb\|upright=3\| Angular position servo and signal flow graph. θ~C~ =
desired angle command, θ~L~ = actual load angle, K~P~ = position loop
gain, V~ωC~ = velocity command, V~ωM~ = motor velocity sense voltage,
K~V~ = velocity loop gain, V~IC~ = current command, V~IM~ = current
sense voltage, K~C~ = current loop gain, V~A~ = power amplifier output
voltage, L~M~ = motor inductance, V~M~ = voltage across motor
inductance, I~M~ = motor current, R~M~ = motor resistance, R~S~ =
current sense resistance, K~M~ = motor torque constant (Nm/amp) , T =
torque, M = momment of inertia of all rotating components α = angular
acceleration, ω = angular velocity, β = mechanical damping, G~M~ = motor
back EMF constant, G~T~ = tachometer conversion gain constant,. There is
one forward path (shown in a different color) and six feedback loops.
The drive shaft assumed to be stiff enough to not treat as a spring.
Constants are shown in black and variables in
purple.


# Control Systems/Bode Plots

## Bode Plots

A Bode Plot is a useful tool that shows the gain and phase response of a
given LTI system for different frequencies. Bode Plots are generally
used with the Fourier Transform of a given system.

center\|framed\|An example of a Bode magnitude and phase plot set. The
Magnitude plot is typically on the top, and the Phase plot is typically
on the bottom of the set.

The frequency of the bode plots are plotted against a logarithmic
frequency axis. Every tickmark on the frequency axis represents a power
of 10 times the previous value. For instance, on a standard Bode plot,
the values of the markers go from (0.1, 1, 10, 100, 1000, \...) Because
each tickmark is a power of 10, they are referred to as a **decade**.
Notice that the \"length\" of a decade decreases as you move to the
right on the graph. (note that this description doesn\'t match the chart
above\... there are 10 tickmarks per decade, not one, but since it is a
log chart they are not evenly spaced).

The bode Magnitude plot measures the system Input/Output ratio in
special units called **decibels**. The Bode phase plot measures the
phase shift in degrees (typically, but radians are also used).

### Decibels

A **Decibel** is a ratio between two numbers on a logarithmic scale. To
express a ratio between two numbers (A and B) as a decibel we apply the
following formula for numbers that represent amplitudes (numbers that
represent a power measurement use a factor of 10 rather than 20):

$$dB = 20 \log\left({A \over B}\right)$$

Where dB is the decibel result.

Or, if we just want to take the decibels of a single number C, we could
just as easily write:

$$dB = 20 \log(C)$$

### Frequency Response Notations

If we have a system transfer function T(s), we can separate it into a
numerator polynomial N(s) and a denominator polynomial D(s). We can
write this as follows:

$$T(s) = \frac{N(s)}{D(s)}$$

To get the magnitude gain plot, we must first transit the transfer
function into the frequency response by using the change of variables:

$$s = j\omega$$

From here, we can say that our frequency response is a composite of two
parts, a real part R and an imaginary part X:

$$T(j\omega) = R(\omega) + jX(\omega)$$

We will use these forms below.

### Straight-Line Approximations

The Bode magnitude and phase plots can be quickly and easily
approximated by using a series of straight lines. These approximate
graphs can be generated by following a few short, simple rules (listed
below). Once the straight-line graph is determined, the actual Bode plot
is a smooth curve that follows the straight lines, and travels through
the **breakpoints**.

### Break Points

If the frequency response is in pole-zero form:

$$T(j\omega) = \frac{\prod_n|j\omega + z_n|}{\prod_m|j\omega + p_m|}$$

We say that the values for all z~n~ and p~m~ are called **break points**
of the Bode plot. These are the values where the Bode plots experience
the largest change in direction.

Break points are sometimes also called \"break frequencies\", \"cutoff
points\", or \"corner points\".

## Bode Gain Plots

**Bode Gain Plots**, or **Bode Magnitude Plots** display the ratio of
the system gain at each input frequency.

### Bode Gain Calculations

The magnitude of the transfer function T is defined as:

$$|T(j\omega)| = \sqrt{R^2 + X^2}$$

However, it is frequently difficult to transition a function that is in
\"numerator/denominator\" form to \"real+imaginary\" form. Luckily, our
decibel calculation comes in handy. Let\'s say we have a frequency
response defined as a fraction with numerator and denominator
polynomials defined as:

$$T(j\omega) = \frac{\prod_n|j\omega + z_n|}{\prod_m|j\omega + p_m|}$$

If we convert both sides to decibels, the logarithms from the decibel
calculations convert multiplication of the arguments into additions, and
the divisions into subtractions:

$$Gain = \sum_n20\log(|j\omega + z_n|) - \sum_m20\log(|j\omega + p_m|)$$

And calculating out the gain of each term and adding them together will
give the gain of the system at that frequency.

### Bode Gain Approximations

The slope of a straight line on a Bode magnitude plot is measured in
units of **dB/Decade**, because the units on the vertical axis are dB,
and the units on the horizontal axis are decades.

The value ω = 0 is infinitely far to the left of the bode plot (because
a logarithmic scale never reaches zero), so finding the value of the
gain at ω = 0 essentially sets that value to be the gain for the Bode
plot from all the way on the left of the graph up till the first break
point. The value of the slope of the line at ω = 0 is 0 dB/Decade.

From each pole break point, the slope of the line decreases by
20 dB/Decade. The line is straight until it reaches the next break
point. From each zero break point the slope of the line increases by
20 dB/Decade. Double, triple, or higher amounts of repeat poles and
zeros affect the gain by multiplicative amounts. Here are some examples:

-   2 poles: -40 dB/Decade
-   10 poles: -200 dB/Decade
-   5 zeros: +100 dB/Decade

## Bode Phase Plots

**Bode phase plots** are plots of the phase shift to an input waveform
dependent on the frequency characteristics of the system input. Again,
the Laplace transform does not account for the phase shift
characteristics of the system, but the Fourier Transform can. The phase
of a complex function, in \"real+imaginary\" form is given as:

$$\angle T(j\omega) = \tan^{-1}\left(\frac{X}{R}\right)$$

## Bode Procedure

Given a frequency response in pole-zero form:

$$T(j\omega) = A\frac{\prod_n|j\omega + z_n|}{\prod_m|j\omega + p_m|}$$

Where A is a non-zero constant (can be negative or positive).

Here are the steps involved in sketching the approximate Bode magnitude
plots:

Here are the steps to drawing the Bode phase plots:

## Examples

### Example: Constant Gain

### Example: Integrator

### Example: Differentiator

### Example: 1st Order, Low-pass Filter (1 Break Point)

## Further reading

-   Circuit Theory/Bode Plots
-   Bode Plots on
    ControlTheoryPro.com


# Control Systems/Stability

## Stability

When a system is unstable, the output of the system may be infinite even
though the input to the system was finite. This causes a number of
practical problems. For instance, a robot arm controller that is
unstable may cause the robot to move dangerously. Also, systems that are
unstable often incur a certain amount of physical damage, which can
become costly. Nonetheless, many systems are inherently unstable - a
fighter jet, for instance, or a rocket at liftoff, are examples of
naturally unstable systems. Although we can design controllers that
stabilize the system, it is first important to understand what stability
is, how it is determined, and why it matters.

The chapters in this section are heavily mathematical and many require a
background in linear differential equations. Readers without a strong
mathematical background might want to review the necessary chapters in
the Calculus and Ordinary Differential
Equations books (or
equivalent) before reading this material.

For most of this chapter we will be assuming that the system is linear
and can be represented either by a set of transfer functions or in state
space. Linear systems have an associated characteristic polynomial which
tells us a great deal about the stability of the system. If any
coefficient of the characteristic polynomial is zero or negative then
the system is either unstable or at most marginally stable. It is
important to note that even if all of the coefficients of the
characteristic polynomial are positive the system may still be unstable.
We will look into this in more detail below.

## BIBO Stability

A system is defined to be **BIBO Stable** if every bounded input to the
system results in a bounded output over the time interval
$[t_0, \infty)$. This must hold for all initial times t~o~. So long as
we don\'t input infinity to our system, we won\'t get infinity output.

A system is defined to be **uniformly BIBO Stable** if there exists a
positive constant *k* that is independent of t~0~ such that for all t~0~
the following conditions:

$$\|u(t)\| \le 1$$

$$t \ge t_0$$

implies that

$$\|y(t)\| \le k$$

There are a number of different types of stability, and keywords that
are used with the topic of stability. Some of the important words that
we are going to be discussing in this chapter, and the next few chapters
are: **BIBO Stable**, **Marginally Stable**, **Conditionally Stable**,
**Uniformly Stable**, **Asymptotically Stable**, and **Unstable**. All
of these words mean slightly different things.

## Determining BIBO Stability

We can prove mathematically that a system f is BIBO stable if an
arbitrary input x is bounded by two finite but large arbitrary constants
M and -M:

$$-M < x \le M$$

We apply the input x, and the arbitrary boundaries M and -M to the
system to produce three outputs:

$$y_x = f(x)$$

$$y_M = f(M)$$

$$y_{-M} = f(-M)$$

Now, all three outputs should be finite for all possible values of M and
x, and they should satisfy the following relationship:

$$y_{-M} \le y_x \le y_M$$

If this condition is satisfied, then the system is BIBO stable.

A SISO linear time-invariant (LTI) system is BIBO stable if and only if
$g(t)$ is absolutely integrable from \[0,∞\] or from:

$$\int_{0}^{\infty} |g(t)| \,dt \leq M < {\infty}$$

### Example

## Poles and Stability

When the poles of the closed-loop transfer function of a given system
are located in the right-half of the S-plane (RHP), the system becomes
unstable. When the poles of the system are located in the left-half
plane (LHP) and the system is not improper, the system is shown to be
stable. A number of tests deal with this particular facet of stability:
The **Routh-Hurwitz Criteria**, the **Root-Locus**, and the **Nyquist
Stability Criteria** all test whether there are poles of the transfer
function in the RHP. We will learn about all these tests in the upcoming
chapters.

If the system is a multivariable, or a MIMO system, then the system is
stable if and only if *every pole of every transfer function* in the
transfer function matrix has a negative real part and every transfer
function in the transfer function matrix is not improper. For these
systems, it is possible to use the Routh-Hurwitz, Root Locus, and
Nyquist methods described later, but these methods must be performed
once for each individual transfer function in the transfer function
matrix.

## Poles and Eigenvalues

The poles of the transfer function, and the eigenvalues of the system
matrix A are related. In fact, we can say that the eigenvalues of the
system matrix A *are the poles of the transfer function* of the system.
In this way, if we have the eigenvalues of a system in the state-space
domain, we can use the Routh-Hurwitz, and Root Locus methods as if we
had our system represented by a transfer function instead.

On a related note, eigenvalues and all methods and mathematical
techniques that use eigenvalues to determine system stability *only work
with time-invariant systems*. In systems which are time-variant, the
methods using eigenvalues to determine system stability fail.

## Transfer Functions Revisited

We are going to have a brief refesher here about transfer functions,
because several of the later chapters will use transfer functions for
analyzing system stability.

Let us remember our generalized feedback-loop transfer function, with a
gain element of K, a forward path Gp(s), and a feedback of Gb(s). We
write the transfer function for this system as:

$$H_{cl}(s) = \frac{KGp(s)}{1 + H_{ol}(s)}$$

Where $H_{cl}$ is the closed-loop transfer function, and $H_{ol}$ is the
open-loop transfer function. Again, we define the open-loop transfer
function as the product of the forward path and the feedback elements,
as such:

$$H_{ol}(s) = KGp(s)Gb(s)$$ \<\-\--Note this definition now contradicts
the updated definition in the Feedback
Loops
section.

Now, we can define F(s) to be the **characteristic equation**. F(s) is
simply the denominator of the closed-loop transfer function, and can be
defined as such:

$$F(s) = 1 + H_{ol} = D(s)$$

We can say conclusively that the roots of the characteristic equation
are the poles of the transfer function. Now, we know a few simple facts:

1.  The locations of the poles of the closed-loop transfer function
    determine if the system is stable or not
2.  The zeros of the characteristic equation are the poles of the
    closed-loop transfer function.
3.  The characteristic equation is always a simpler equation than the
    closed-loop transfer function.

These functions combined show us that we can focus our attention on the
characteristic equation, and find the roots of that equation.

## State-Space and Stability

As we have discussed earlier, the system is stable if the eigenvalues of
the system matrix A have negative real parts. However, there are other
stability issues that we can analyze, such as whether a system is
*uniformly stable*, *asymptotically stable*, or otherwise. We will
discuss all these topics in a later chapter.

## Marginal Stability

When the poles of the system in the complex s-domain exist on the
imaginary axis (the vertical axis), or when the eigenvalues of the
system matrix are imaginary (no real part), the system exhibits
oscillatory characteristics, and is said to be marginally stable. A
marginally stable system may become unstable under certain
circumstances, and may be perfectly stable under other circumstances. It
is impossible to tell by inspection whether a marginally stable system
will become unstable or not.

We will discuss marginal stability more in the following chapters.


# Control Systems/State-Space Stability

## State-Space Stability

If a system is represented in the state-space domain, it doesn\'t make
sense to convert that system to a transfer function representation (or
even a transfer matrix representation) in an attempt to use any of the
previous stability methods. Luckily, there are other analysis methods
that can be used with the state-space representation to determine if a
system is stable or not. First, let us first introduce the notion of
unstability:

Also, a key concept when we are talking about stability of systems is
the concept of an **equilibrium point**:

The definitions below typically require that the equilibrium point be
zero. If we have an equilibrium point *x~e~ = a*, then we can use the
following change of variables to make the equilibrium point zero:

$$\bar{x} = x_e - a = 0$$

We will also see below that a system\'s stability is defined in terms of
an equilibrium point. Related to the concept of an equilibrium point is
the notion of a **zero point**:

### Stability Definitions

The equilibrium *x = 0* of the system is stable if and only if the
solutions of the zero-input state equation are bounded. Equivalently, *x
= 0* is a stable equilibrium if and only if for every initial time t~0~,
there exists an associated finite constant *k*(t~0~) such that:

$$\operatorname{sup}_{t \ge t_0}\|\phi(t, t_0)\| = k(t_0) < \infty$$

Where *sup* is the **supremum**, or \"maximum\" value of the equation.
The maximum value of this equation must never exceed the arbitrary
finite constant *k* (and therefore it may not be infinite at any point).

Uniform stability is a more general, and more powerful form of stability
than was previously provided.

A time-invariant system is asymptotically stable if all the eigenvalues
of the system matrix A have negative real parts. If a system is
asymptotically stable, it is also BIBO stable. However the inverse is
not true: A system that is BIBO stable might not be asymptotically
stable.

For linear systems, uniform asymptotic stability is the same as
**exponential stability**. This is not the case with non-linear systems.

### Marginal Stability

Here we will discuss some rules concerning systems that are marginally
stable. Because we are discussing eigenvalues and eigenvectors, these
theorems only apply to time-invariant systems.

1.  A time-invariant system is marginally stable if and only if all the
    eigenvalues of the system matrix A are zero or have negative real
    parts, and those with zero real parts are simple roots of the
    minimal polynomial of A.
2.  The equilibrium *x = 0* of the state equation is *uniformly stable*
    if all eigenvalues of A have non-positive real parts, and there is a
    complete set of distinct eigenvectors associated with the
    eigenvalues with zero real parts.
3.  The equilibrium *x = 0* of the state equation is *exponentially
    stable* if and only if all eigenvalues of the system matrix A have
    negative real parts.

## Eigenvalues and Poles

A Linearly Time Invariant (LTI) system is stable (asymptotically stable,
see above) if all the eigenvalues of A have negative real parts.
Consider the following state equation:

$$x' = Ax(t) + Bu(t)$$

We can take the Laplace Transform of both sides of this equation, using
initial conditions of x~0~ = 0:

$$sX(s) = AX(s) + BU(s)$$

Subtract AX(s) from both sides:

$$sX(s) - AX(s) = BU(s)$$

$$(sI - A)X(s) = BU(s)$$

Assuming (sI - A) is nonsingular, we can multiply both sides by the
inverse:

$$X(s) = (sI - A)^{-1}BU(s)$$

Now, if we remember our formula for finding the matrix inverse from the
adjoint matrix:

$$A^{-1} = \frac{\operatorname{adj}(A)}{|A|}$$

We can use that definition here:

$$X(s) = \frac{\operatorname{adj}(sI - A)BU(s)}{|(sI - A)|}$$

Let\'s look at the denominator (which we will now call D(s)) more
closely. To be stable, the following condition must be true:

$$D(s) = |(sI - A)| = 0$$

And if we substitute λ for s, we see that this is actually the
characteristic equation of matrix A! This means that the values for s
that satisfy the equation (the poles of our transfer function) are
precisely the eigenvalues of matrix A. In the S domain, it is required
that all the poles of the system be located in the left-half plane, and
therefore all the eigenvalues of A must have negative real parts.

## Impulse Response Matrix

We can define the **Impulse response matrix**, *G*(t, τ) in order to
define further tests for stability:

$$G(t, \tau) = \left\{\begin{matrix}C(t)\phi(t, \tau)B(\tau) & \mbox{ if } t \ge \tau \\0 & \mbox{ if } t < \tau\end{matrix}\right.$$

The system is *uniformly stable* if and only if there exists a finite
positive constant *L* such that for all time *t* and all initial
conditions t~0~ with $t \ge t_0$ the following integral is satisfied:

$$\int_0^t \|G(t, \tau)\|d\tau \le L$$

In other words, the above integral must have a finite value, or the
system is not uniformly stable.

In the time-invariant case, the impulse response matrix reduces to:

$$G(t) = \left\{\begin{matrix}Ce^{At}B & \mbox{ if } t \ge 0 \\0 & \mbox{ if } t < 0\end{matrix}\right.$$

In a time-invariant system, we can use the impulse response matrix to
determine if the system is uniformly BIBO stable by taking a similar
integral:

$$\int_0^\infty \|G(t)\|dt \le L$$

Where *L* is a finite constant.

## Positive Definiteness

These terms are important, and will be used in further discussions on
this topic.

-   f(x) is **positive definite** if f(x) \> 0 for all x.
-   f(x) is **positive semi-definite** if $f(x) \ge 0$ for all x, and
    f(x) = 0 only if x = 0.
-   f(x) is **negative definite** if f(x) \< 0 for all x.
-   f(x) is **negative semi-definite** if $f(x) \le 0$ for all x, and
    f(x) = 0 only if x = 0.

A Hermitian matrix X is positive definite if all its principle minors
are positive. Also, a matrix X is positive definite if all its
eigenvalues have positive real parts. These two methods may be used
interchangeably.

Positive definiteness is a very important concept. So much so that the
Lyapunov stability test depends on it. The other categorizations are not
as important, but are included here for completeness.

## Lyapunov Stability

### Lyapunov\'s Equation

For linear systems, we can use the **Lyapunov Equation**, below, to
determine if a system is stable. We will state the Lyapunov Equation
first, and then state the **Lyapunov Stability Theorem**.

$$MA + A^TM = -N$$

Where A is the system matrix, and M and N are *p* × *p* square matrices.

Notice that for the Lyapunov Equation to be satisfied, the matrices must
be compatible sizes. In fact, matrices A, M, and N must all be square
matrices of equal size. Alternatively, we can write:

If the matrix M can be calculated in this manner, the system is
asymptotically stable.


# Control Systems/Discrete Time Stability

## Discrete-Time Stability

The stability analysis of a discrete-time or digital system is similar
to the analysis for a continuous time system. However, there are enough
differences that it warrants a separate chapter.

## Input-Output Stability

### Uniform Stability

An LTI causal system is uniformly BIBO stable if there exists a positive
constant L such that the following conditions:

$$x[n_0] = 0$$

$$\|u[n]\| \le k$$

$$k \ge 0$$

imply that

$$\|y[n]\| \le L$$

### Impulse Response Matrix

We can define the **impulse response matrix** of a discrete-time system
as:

$$G[n] = \left\{\begin{matrix}CA^{k-1}B & \mbox{ if } k > 0 \\ 0 & \mbox{ if } k \le 0\end{matrix}\right.$$

Or, in the general time-varying case:

$$G[n] = \left\{\begin{matrix}C\phi[n, n_0]B & \mbox{ if } k > 0 \\ 0 & \mbox{ if } k \le 0\end{matrix}\right.$$

A digital system is BIBO stable if and only if there exists a positive
constant *L* such that for all non-negative *k*:

$$\sum_{n = 0}^{k}\|G[n]\| \le L$$

## Stability of Transfer Function

A MIMO discrete-time system is BIBO stable if and only if every pole of
every transfer function in the transfer function matrix has a magnitude
less than 1. All poles of all transfer functions must exist inside the
unit circle on the Z plane.

## Lyapunov Stability

There is a discrete version of the Lyapunov stability theorem that
applies to digital systems. Given the **discrete Lyapunov equation**:

$$A^TMA - M = -N$$

We can use this version of the Lyapunov equation to define a condition
for stability in discrete-time systems:

## Poles and Eigenvalues

Every pole of G(z) is an eigenvalue of the system matrix A. Not every
eigenvalue of A is a pole of G(z). Like the poles of the transfer
function, all the eigenvalues of the system matrix must have magnitudes
less than 1. Mathematically:

$$\sqrt{\operatorname{Re}(z)^2 + \operatorname{Im}(z)^2} \le 1$$

If the magnitude of the eigenvalues of the system matrix A, or the poles
of the transfer functions are greater than 1, the system is unstable.

## Finite Wordlengths

Digital computer systems have an inherent problem because implementable
computer systems have finite wordlengths to deal with. Some of the
issues are:

1.  Real numbers can only be represented with a finite precision.
    Typically, a computer system can only accurately represent a number
    to a finite number of decimal points.
2.  Because of the fact above, computer systems with feedback can
    compound errors with each program iteration. Small errors in one
    step of an algorithm can lead to large errors later in the program.
3.  Integer numbers in computer systems have finite lengths. Because of
    this, integer numbers will either **roll-over**, or **saturate**,
    depending on the design of the computer system. Both situations can
    create inaccurate results.


# Control Systems/Routh-Hurwitz Criterion

## Stability Criteria

The Routh-Hurwitz stability criterion provides a simple algorithm to
decide whether or not the zeros of a polynomial are all in the left half
of the complex plane (such a polynomial is called at times \"Hurwitz\").
A Hurwitz polynomial is a key requirement for a linear continuous-time
invariant to be stable (all bounded inputs produce bounded outputs).

Necessary stability conditions: Conditions that must hold for a polynomial to be Hurwitz.

If any of them fails - the polynomial is not stable. However, they may
all hold without implying stability.

Sufficient stability conditions: Conditions that if met imply that the polynomial is stable. However, a polynomial may be stable without implying some or any of them.

The Routh criteria provides condition that are both necessary and
sufficient for a polynomial to be Hurwitz.

## Routh-Hurwitz Criteria

The Routh-Hurwitz criteria is comprised of three separate tests that
must be satisfied. If any single test fails, the system is not stable
and further tests need not be performed. For this reason, the tests are
arranged in order from the easiest to determine to the hardest.

The Routh Hurwitz test is performed on the denominator of the transfer
function, the **characteristic equation**. For instance, in a
closed-loop transfer function with G(s) in the forward path, and H(s) in
the feedback loop, we have:

$$T(s) = \frac{G(s)}{1 + G(s)H(s)}$$

If we simplify this equation, we will have an equation with a numerator
N(s), and a denominator D(s):

$$T(s) = \frac{N(s)}{D(s)}$$

The Routh-Hurwitz criteria will focus on the denominator polynomial
D(s).

### Routh-Hurwitz Tests

Here are the three tests of the Routh-Hurwitz Criteria. For convenience,
we will use N as the order of the polynomial (the value of the highest
exponent of s in D(s)). The equation D(s) can be represented generally
as follows:

$$D(s) = a_0 + a_1s + a_2s^2 + \cdots + a_Ns^N$$

We will explain the Routh array below.

### The Routh\'s Array

The Routh array is formed by taking all the coefficients a~i~ of D(s),
and staggering them in array form. The final columns for each row should
contain zeros:

$$\begin{matrix}s^N \\ s^{N-1} \end{matrix}
       \begin{vmatrix}a_N & a_{N - 2} & \cdots & 0 \\ a_{N-1} & a_{N-3} & \cdots & 0
 \end{vmatrix}$$

Therefore, if N is odd, the top row will be all the odd coefficients. If
N is even, the top row will be all the even coefficients. We can fill in
the remainder of the Routh Array as follows:

$$\begin{matrix}s^N \\ s^{N-1} \\  \\  \\ s^0 \end{matrix}
       \begin{vmatrix}a_N & a_{N - 2} & \cdots & 0
                   \\ a_{N-1} & a_{N-3} & \cdots & 0
                   \\ b_{N-1} & b_{N-3} & \cdots
                   \\ c_{N-1} & c_{N-3} & \cdots
                   \\ \cdots
 \end{vmatrix}$$

Now, we can define all our b, c, and other coefficients, until we reach
row s^0^. To fill them in, we use the following formulae:

$$b_{N-1} = \frac{-1}{a_{N-1}}\begin{vmatrix}a_N & a_{N-2} \\ a_{N-1} & a_{N-3}\end{vmatrix}$$

And

$$b_{N-3} = \frac{-1}{a_{N-1}}\begin{vmatrix}a_N & a_{N-4} \\ a_{N-1} & a_{N-5}\end{vmatrix}$$

For each row that we are computing, we call the left-most element in the
row directly above it the **pivot element**. For instance, in row b, the
pivot element is a~N-1~, and in row c, the pivot element is b~N-1~ and
so on and so forth until we reach the bottom of the array.

To obtain any element, we negate the determinant of the following
matrix, and divide by the pivot element:

$$\begin{vmatrix}k & m \\ l & n \end{vmatrix}$$

Where:

-   **k** is the left-most element two rows above the current row.
-   **l** is the pivot element.
-   **m** is the element two rows up, and one column to the right of the
    current element.
-   **n** is the element one row up, and one column to the right of the
    current element.

In terms of **k l m n**, our equation is:

$$v = \frac{(lm) - (kn)}{l}$$

### Example: Calculating C~N-3~

\\begin{vmatrix}a\_{N-1} & a\_{N-5} \\\\ b\_{N-1} & b\_{N-5}
\\end{vmatrix} = \\frac{a\_{N-1}b\_{N-5} - b\_{N-1}a\_{N-5}}{-
b\_{N-1}}`</math>`{=html}}}

### Example: Stable Third Order System

= 3`</math>`{=html}

$$c_{N-3} = \frac{(2)(0) - \left(\frac{5}{2}\right)(0)}{\frac{5}{2}} = 0$$

And filling these values into our Routh Array, we can determine whether
the system is stable:

$$\begin{matrix}s^3 \\ s^2 \\ s^1 \\ s^0 \end{matrix}
       \begin{vmatrix}1 & 4 & 0
                    \\ 2 & 3 & 0
                    \\ \frac{5}{2} & 0 & 0
                    \\ 3 & 0 & 0
 \end{vmatrix}$$

From this array, we can clearly see that all of the signs of the first
column are positive, there are no sign changes, and therefore there are
no poles of the characteristic equation in the RHP.}}

### Special Case: Row of All Zeros

If, while calculating our Routh-Hurwitz, we obtain a row of all zeros,
we do not stop, but can actually learn more information about our
system.

If we have a row of all zeros, the row directly above it is known as the
**Auxiliary Polynomial**, and can be very helpful. The roots of the
auxiliary polynomial give us the precise locations of complex conjugate
roots that lie on the jω axis. However, one important point to notice is
that if there are repeated roots on the jω axis, the system is actually
**unstable**. Therefore, we must use the auxiliary polynomial to
determine whether the roots are repeated or not.

The auxiliary equation is to be differentiated with respect to s and the
coefficients of this equation replaces the all zero row. Routh array can
be further calculated using these new values.

### Special Case: Zero in the First Column

In this special case, there is a zero in the first column of the Routh
Array, but the other elements of that row are non-zero. Like the above
case, we can replace the zero with a small variable epsilon (ε) and use
that variable to continue our calculations. After we have constructed
the entire array, we can take the limit as epsilon approaches zero to
get our final values. If the sign coefficient above the (ε) is the same
as below it, this indicates a pure imaginary root.


# Control Systems/Jurys Test

## Routh-Hurwitz in Digital Systems

Because of the differences in the Z and S domains, the Routh-Hurwitz
criteria can not be used directly with digital systems. This is because
digital systems and continuous-time systems have different regions of
stability. However, there are some methods that we can use to analyze
the stability of digital systems. Our first option (and arguably not a
very good option) is to convert the digital system into a
continuous-time representation using the **bilinear transform**. The
bilinear transform converts an equation in the Z domain into an equation
in the W domain, that has properties similar to the S domain. Another
possibility is to use **Jury\'s Stability Test**. Jury\'s test is a
procedure similar to the RH test, except it has been modified to analyze
digital systems in the Z domain directly.

### Bilinear Transform

One common, but time-consuming, method of analyzing the stability of a
digital system in the z-domain is to use the bilinear transform to
convert the transfer function from the z-domain to the w-domain. The
w-domain is similar to the s-domain in the following ways:

-   Poles in the right-half plane are unstable
-   Poles in the left-half plane are stable
-   Poles on the imaginary axis are partially stable

The w-domain is warped with respect to the s domain, however, and except
for the relative position of poles to the imaginary axis, they are not
in the same places as they would be in the s-domain.

Remember, however, that the Routh-Hurwitz criterion can tell us whether
a pole is unstable or not, and nothing else. Therefore, it doesn\'t
matter where exactly the pole is, so long as it is in the correct
half-plane. Since we know that stable poles are in the left-half of the
w-plane and the s-plane, and that unstable poles are on the right-hand
side of both planes, we can use the Routh-Hurwitz test on functions in
the w domain exactly like we can use it on functions in the s-domain.

### Other Mappings

There are other methods for mapping an equation in the Z domain into an
equation in the S domain, or a similar domain. We will discuss these
different methods in the
**Appendix**.

## Jury\'s Test

Jury\'s test is a test that is similar to the Routh-Hurwitz criterion,
except that it can be used to analyze the stability of an LTI digital
system in the Z domain. To use Jury\'s test to determine if a digital
system is stable, we must check our z-domain characteristic equation
against a number of specific rules and requirements. If the function
fails any requirement, it is not stable. If the function passes all the
requirements, it is stable. Jury\'s test is a necessary and sufficient
test for stability in digital systems.

Again, we call D(z) the **characteristic polynomial** of the system. It
is the denominator polynomial of the Z-domain transfer function. Jury\'s
test will focus exclusively on the Characteristic polynomial. To perform
Jury\'s test, we must perform a number of smaller tests on the system.
If the system fails any test, it is unstable.

### Jury Tests

Given a characteristic equation in the form:

$$D(z) = a_0 + a_1z + a_2z^2 + \cdots + a_Nz^N$$

The following tests determine whether this system has any poles outside
the unit circle (the instability region). These tests will use the value
N as being the degree of the characteristic polynomial.

While you are constructing the Jury Array, you can be making the tests
of **Rule 4**. If the Array fails **Rule 4** at any point, you can stop
calculating the array: your system is unstable. We will discuss the
construction of the Jury Array below.

### The Jury Array

The Jury Array is constructed by first writing out a row of
coefficients, and then writing out another row with the same
coefficients in reverse order. For instance, if your polynomial is a
third order system, we can write the First two lines of the Jury Array
as follows:

$$\overline{\underline{
       \begin{matrix} z^0 & z^1 & z^2 & z^3 & \ldots & z^N
                   \\ a_0 & a_1 & a_2 & a_3 & \ldots& a_N
                   \\ a_N & \ldots & a_3 & a_2 & a_1 & a_0
       \end{matrix}}}$$

Now, once we have the first row of our coefficients written out, we add
another row of coefficients (we will use **b** for this row, and **c**
for the next row, as per our previous convention), and we will calculate
the values of the lower rows from the values of the upper rows. Each new
row that we add will have one fewer coefficient then the row before it:

$$\overline{\underline{
       \begin{matrix} 1) & a_0 & a_1 & a_2 & a_3 & \ldots & a_N
                   \\ 2) & a_N & \ldots & a_3 & a_2 & a_1 & a_0
                   \\ 3) & b_0 & b_1 & b_2 & \ldots & b_{N-1}
                   \\ 4) & b_{N-1}& \ldots & b_2 & b_1 & b_0
                   \\ \vdots & \vdots & \vdots & \vdots
                   \\ 2N-3) & v_0 & v_1 & v_2
       \end{matrix}}}$$ Note: The last file is the (2N-3) file, and
always has 3 elements. This test doesn\'t have sense if N=1, but in this
case you know the pole!

Once we get to a row with 2 members, we can stop constructing the array.

To calculate the values of the odd-number rows, we can use the following
formulae. The even number rows are equal to the previous row in reverse
order. We will use k as an arbitrary subscript value. These formulae are
reusable for all elements in the array:

$$b_k =  \begin{vmatrix} a_0 & a_{N-k}
                           \\ a_N & a_k
              \end{vmatrix}$$

$$c_k =  \begin{vmatrix} b_0 & b_{N-1-k}
                           \\ b_{N-1} & b_k
              \end{vmatrix}$$

$$d_k =  \begin{vmatrix} c_0 & c_{N-2-k}
                           \\ c_{N-2} & c_k
              \end{vmatrix}$$ This pattern can be carried on to all
lower rows of the array, if needed.

### Example: Calculating e~5~

## Further reading

We will discuss the bilinear transform, and other methods to convert
between the Laplace domain and the Z domain in the appendix:

-   Z Transform
    Mappings


# Control Systems/Root Locus

## The Problem

Consider a system like a radio. The radio has a \"volume\" knob, that
controls the amount of gain of the system. High volume means more power
going to the speakers, low volume means less power to the speakers. As
the volume value increases, the poles of the transfer function of the
radio change, and they might potentially become unstable. We would like
to find out *if* the radio becomes unstable, and if so, we would like to
find out what values of the volume cause it to become unstable. Our
current methods would require us to plug in each new value for the
volume (gain, \"K\"), and solve the open-loop transfer function for the
roots. This process can be a long one. Luckily, there is a method called
the **root-locus** method, that allows us to graph the locations of all
the poles of the system for all values of gain, K

## Root-Locus

As we change gain, we notice that the system poles and zeros actually
move around in the S-plane. This fact can make
life particularly difficult, when we need to solve higher-order
equations repeatedly, for each new gain value. The solution to this
problem is a technique known as **Root-Locus** graphs. Root-Locus allows
you to graph the locations of the poles and zeros *for every value of
gain*, by following several simple rules. As we know that a fan switch
also can control the speed of the fan.

Let\'s say we have a closed-loop transfer function for a particular
system:

$$\frac{N(s)}{D(s)} = \frac{KG(s)}{1 + KG(s)H(s)}$$

Where N is the numerator polynomial and D is the denominator polynomial
of the transfer functions, respectively. Now, we know that to find the
poles of the equation, we must set the denominator to 0, and solve the
characteristic equation. In other words, the locations of the poles of a
specific equation must satisfy the following relationship:

$$D(s) = 1 + KG(s)H(s) = 0$$

from this same equation, we can manipulate the equation as such:

$$1 + KG(s)H(s) = 0$$

$$KG(s)H(s) = -1$$

And finally by converting to polar coordinates:

$$\angle KG(s)H(s) = 180^\circ$$

Now we have 2 equations that govern the locations of the poles of a
system for all gain values:

$$1 + KG(s)H(s) = 0$$

$$\angle KG(s)H(s) = 180^\circ$$

### Digital Systems

The same basic method can be used for considering digital systems in the
Z-domain:

$$\frac{N(z)}{D(z)} = \frac{KG(z)}{1 + K\overline{GH}(z)}$$

Where N is the numerator polynomial in z, D is the denominator
polynomial in z, and $\overline{GH}(z)$ is the open-loop transfer
function of the system, in the Z domain.

The denominator D(z), by the definition of the characteristic equation
is equal to:

$$D(z) = 1 + K\overline{GH}(z) = 0$$

We can manipulate this as follows:

$$1 + K\overline{GH}(z) = 0$$

$$K\overline{GH}(z) = -1$$

We can now convert this to polar coordinates, and take the angle of the
polynomial:

$$\angle K\overline{GH}(z) = 180^\circ$$

We are now left with two important equations:

$$1 + K\overline{GH}(z) = 0$$

$$\angle K\overline{GH}(z) = 180^\circ$$

If you will compare the two, the Z-domain equations are nearly identical
to the S-domain equations, and act exactly the same. For the remainder
of the chapter, we will only consider the S-domain equations, with the
understanding that digital systems operate in nearly the same manner.

## The Root-Locus Procedure

In the transform domain (see note at right), when the gain is small, the
poles start at the poles of the open-loop transfer function. When gain
becomes infinity, the poles move to overlap the zeros of the system.
This means that on a root-locus graph, all the poles move towards a
zero. Only one pole may move towards one zero, and this means that there
must be the same number of poles as zeros.

If there are fewer zeros than poles in the transfer function, there are
a number of implicit zeros located at infinity, that the poles will
approach.

First thing, we need to convert the magnitude equation into a slightly
more convenient form:

$$KG(s)H(s) + 1 = 0 \to G(s)H(s) = \frac{-1}{K}$$

Now, we can assume that G(s)H(s) is a fraction of some sort, with a
numerator and a denominator that are both polynomials. We can express
this equation using arbitrary functions a(s) and b(s), as such:

$$\frac{a(s)}{b(s)} = \frac{-1}{K}$$

We will refer to these functions a(s) and b(s) later in the procedure.

We can start drawing the root-locus by first placing the roots of b(s)
on the graph with an \'X\'. Next, we place the roots of a(s) on the
graph, and mark them with an \'O\'.

Next, we examine the real-axis. starting from the right-hand side of the
graph and traveling to the left, we draw a root-locus line on the
real-axis at every point to the left of an odd number of poles or zeros
on the real-axis. This may sound tricky at first, but it becomes easier
with practice.

Now, a root-locus line starts at every pole. Therefore, any place that
two poles appear to be connected by a root locus line on the real-axis,
the two poles actually move towards each other, and then they \"break
away\", and move off the axis. The point where the poles break off the
axis is called the **breakaway point**. From here, the root locus lines
travel towards the nearest zero.

It is important to note that the s-plane is symmetrical about the real
axis, so whatever is drawn on the top-half of the S-plane, must be drawn
in mirror-image on the bottom-half plane.

Once a pole breaks away from the real axis, they can either travel out
towards infinity (to meet an implicit zero), or they can travel to meet
an explicit zero, or they can re-join the real-axis to meet a zero that
is located on the real-axis. If a pole is traveling towards infinity, it
always follows an asymptote. The number of asymptotes is equal to the
number of implicit zeros at infinity.

## Root Locus Rules

Here is the complete set of rules for drawing the root-locus graph. We
will use p and z to denote the number of poles and the number of zeros
of the open-loop transfer function, respectively. We will use P~i~ and
Z~i~ to denote the location of the *i*th pole and the *i*th zero,
respectively. Likewise, we will use ψ~i~ and ρ~i~ to denote the angle
from a given point to the *i*th pole and zero, respectively. All angles
are given in radians (π denotes π radians).

There are 11 rules that, if followed correctly, will allow you to create
a correct root-locus graph.

We will explain these rules in the rest of the chapter.

## Root Locus Equations

Here are the two major equations:

:   {\| class=\"wikitable\"

! S-Domain Equations !! Z-Domain Equations \|- \|$1 + KG(s)H(s) = 0$
\|$1 + K\overline{GH}(z) = 0$ \|- \|$\angle KG(s)H(s) = 180^o$
\|$\angle K\overline{GH}(z) = 180^o$ \|}

Note that the sum of the angles of all the poles and zeros must equal to
180.

### Number of Asymptotes

If the number of explicit zeros of the system is denoted by Z (uppercase
z), and the number of poles of the system is given by P, then the number
of asymptotes (N~a~) is given by:

$$N_a = P - Z$$

The angles of the asymptotes are given by:

$$\phi_k = (2k + 1)\frac{\pi}{P - Z}$$

for values of $k = [0, 1, ... N_a - 1]$.

### Asymptote Intersection Point

The asymptotes intersect the real axis at the point:

$$\sigma_0 = \frac{\sum_P - \sum_Z}{P - Z}$$

Where $\sum_P$ is the sum of all the locations of the poles, and
$\sum_Z$ is the sum of all the locations of the explicit zeros.

### Breakaway Points

The breakaway points are located at the roots of the following equation:

$$\frac{dG(s)H(s)}{ds} = 0$$ or $\frac{d\overline{GH}(z)}{dz} = 0$

Once you solve for z, the real roots give you the breakaway/reentry
points. Complex roots correspond to a lack of breakaway/reentry.

The breakaway point equation can be difficult to solve, so many times
the actual location is approximated.

## Root Locus and Stability

The root locus procedure should produce a graph of where the poles of
the system are for all values of gain K. When any or all of the roots of
D are in the unstable region, the system is unstable. When any of the
roots are in the marginally stable region, the system is marginally
stable (oscillatory). When all of the roots of D are in the stable
region, then the system is stable.

It is important to note that a system that is stable for gain K~1~ may
become unstable for a different gain K~2~. Some systems may have poles
that cross over from stable to unstable multiple times, giving multiple
gain values for which the system is unstable.

Here is a quick refresher:

:   {\|class=\"wikitable\"

! Region ! colspan=2 \| S-Domain ! colspan=2 \| Z-Domain \|- ! Stable
Region \| Left-Hand S Plane \|\| $\sigma < 0$\|\| Inside the Unit Circle
\|\| $|z| < 1$ \|- ! Marginally Stable Region \| The vertical axis \|\|
$\sigma = 0$ \|\| The Unit Circle \|\| $|z| = 1$ \|- ! Unstable Region
\| Right-Hand S Plane \|\| $\sigma > 0$ \|\| Outside the Unit Circle,
\|\| $|z| > 1$ \|}

## Examples

### Example 1: First-Order System

### Example 2: Third Order System

### Example: Complex-Conjugate Zeros

### Example: Root-Locus Using MATLAB/Octave

{{TextBox\|1=Use MATLAB, Octave, or another piece of mathematical
simulation software to produce the root-locus graph for the following
system:

$$T(s) = K\frac{s^2+7s+12}{(s^2 + 3s + 6)}$$

First, we must multiply through in the denominator:

$$N(s) = S^2+7S+12$$

$$D(s) = S^2+3S+2$$

Now, we can generate the coefficient vectors from the numerator and
denominator:

     num = [0 1 7 12];
     den = [0 1 3 2];

Next, we can feed these vectors into the **rlocus** command:

     rlocus(num, den);

**Note**:In Octave, we need to create a system structure first, by
typing:

     sys = tf(num, den);
     rlocus(sys);

Either way, we generate the following graph:

![](Root_Locus_diagram_.svg "Root_Locus_diagram_.svg"){width="600"}