# Control Systems/Nyquist Stability Criteria

## Nyquist Stability Criteria

The **Nyquist Stability Criteria** is a test for system stability, just
like the
Routh-Hurwitz
test, or the Root-Locus
Methodology. However, the Nyquist Criteria can also give us additional
information about a system. Routh-Hurwitz and Root-Locus can tell us
where the poles of the system are for particular values of gain. By
altering the gain of the system, we can determine if any of the poles
move into the RHP, and therefore become unstable. The Nyquist Criteria,
however, can tell us things about the *frequency characteristics* of the
system. For instance, some systems with constant gain might be stable
for low-frequency inputs, but become unstable for high-frequency inputs.

Also, the Nyquist Criteria can tell us things about the phase of the
input signals, the time-shift of the system, and other important
information.

## Contours

A **contour** is a complicated mathematical construct, but luckily we
only need to worry ourselves with a few points about them. We will
denote contours with the Greek letter Γ (gamma). Contours are lines,
drawn on a graph, that follow certain rules:

1.  The contour must close (it must form a complete loop)
2.  The contour may not cross directly through a pole of the system.
3.  Contours must have a direction (clockwise or counterclockwise,
    generally).
4.  A contour is called \"simple\" if it has no self-intersections. We
    only consider simple contours here.

Once we have such a contour, we can develop some important theorems
about them, and finally use these theorems to derive the **Nyquist
stability criterion**.

## Argument Principle

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

When we have our contour, Γ, we transform it into $\Gamma_{F(s)}$ by
plugging every point of the contour into the function F(s), and taking
the resultant value to be a point on the transformed contour.

### Example: First Order System

### Example: Second-Order System

## The Nyquist Contour

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

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

## Nyquist Criteria

Let us first introduce the most important equation when dealing with the
Nyquist criterion:

$$N = Z - P$$

Where:

-   N is the number of encirclements of the (-1, 0) point.
-   Z is the number of zeros of the characteristic equation.
-   P is the number of poles in the of the open-loop characteristic
    equation.

With this equation stated, we can now state the **Nyquist Stability
Criterion**: `{{TextBox|1=
;Nyquist Stability Criterion:A feedback control system is stable, if and only if the contour <math>\Gamma_{F(s)}</math> in the F(s) plane does not encircle the (-1, 0) point when P is 0.

:A feedback control system is stable, if and only if the contour <math>\Gamma_{F(s)}</math> in the F(s) plane encircles the (-1, 0) point a number of times equal to the number of poles of F(s) enclosed by Γ.}}`{=mediawiki}

In other words, if P is zero then N must equal zero. Otherwise, N must
equal P. Essentially, we are saying that Z must always equal zero,
because Z is the number of zeros of the characteristic equation (and
therefore the number of poles of the closed-loop transfer function) that
are in the right-half of the s plane.

Keep in mind that we don\'t necessarily know the locations of all the
zeros of the characteristic equation. So if we find, using the nyquist
criterion, that the number of poles is not equal to N, then we know that
there must be a zero in the right-half plane, and that therefore the
system is unstable.

## Nyquist ↔ Bode

A careful inspection of the Nyquist plot will reveal a surprising
relationship to the Bode plots of the system. If we use the Bode phase
plot as the angle θ, and the Bode magnitude plot as the distance r, then
it becomes apparent that the Nyquist plot of a system is simply the
polar representation of the Bode plots.

To obtain the Nyquist plot from the Bode plots, we take the phase angle
and the magnitude value at each frequency ω. We convert the magnitude
value from decibels back into gain ratios. Then, we plot the ordered
pairs (r, θ) on a polar graph.

## Nyquist in the Z Domain

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


# Control Systems/Controllability and Observability

## System Interaction

In the world of control engineering, there are a slew of systems
available that need to be controlled. The task of a control engineer is
to design controller and compensator units to interact with these
pre-existing systems. However, some systems simply cannot be controlled
(or, more often, cannot be controlled in specific ways). The concept of
**controllability** refers to the ability of a controller to arbitrarily
alter the functionality of the system plant.

The state-variable of a system, *x*, represents the internal workings of
the system that can be separate from the regular input-output
relationship of the system. This also needs to be measured, or
*observed*. The term **observability** describes whether the internal
state variables of the system can be externally measured.

## Controllability

Complete state controllability (or simply controllability if no other
context is given) describes the ability of an external input to move the
internal state of a system from any initial state to any other final
state in a finite time interval

We will start off with the definitions of the term **controllability**,
and the related terms **reachability** and **stabilizability**.

We can also write out the definition of reachability more precisely:

Similarly, we can more precisely define the concept of controllability:

### Controllability Matrix

For LTI (linear time-invariant) systems, a system is reachable if and
only if its **controllability matrix**, ζ, has a full row rank of *p*,
where *p* is the dimension of the matrix A, and *p* × *q* is the
dimension of matrix B.

$$\zeta = \begin{bmatrix}B & AB & A^2B & \cdots & A^{p-1}B\end{bmatrix} \in R^{p \times pq}$$

A system is controllable or \"Controllable to the origin\" when any
state x~1~ can be driven to the zero state *x = 0* in a finite number of
steps.

A system is controllable when the rank of the system matrix A is *p*,
and the rank of the controllability matrix is equal to:

$$Rank(\zeta) = Rank(A^{-1}\zeta) = p$$

If the second equation is not satisfied, the system is not .

MATLAB allows one to easily create the controllability matrix with the
**ctrb** command. To create the controllability matrix $\zeta$ simply
type

$$\zeta=ctrb(A,B)$$

where A and B are mentioned above. Then in order to determine if the
system is controllable or not one can use the rank command to determine
if it has full rank.

If

$$Rank(A) < p$$

Then controllability does not imply reachability.

-   Reachability always implies controllability.
-   Controllability only implies reachability when the state transition
    matrix is nonsingular.

### Determining Reachability

There are four methods that can be used to determine if a system is
reachable or not:

1.  If the *p* rows of $\phi(t, \tau)B(t)$ are linearly independent over
    the field of complex numbers. That is, if the rank of the product of
    those two matrices is equal to *p* for all values of *t* and *τ*
2.  If the rank of the controllability matrix is the same as the rank of
    the system matrix A.
3.  If the rank of $\operatorname{rank}[\lambda I - A, B] = p$ for all
    eigenvalues λ of the matrix A.
4.  If the rank of the **reachability gramian** (described below) is
    equal to the rank of the system matrix A.

Each one of these conditions is both necessary and sufficient. If any
one test fails, all the tests will fail, and the system is not
reachable. If any test is positive, then all the tests will be positive,
and the system is reachable.

### Gramians

**Gramians** are complicated mathematical functions that can be used to
determine specific things about a system. For instance, we can use
gramians to determine whether a system is controllable or reachable.
Gramians, because they are more complicated than other methods, are
typically only used when other methods of analyzing a system fail (or
are too difficult).

All the gramians presented on this page are all matrices with dimension
*p* × *p* (the same size as the system matrix A).

All the gramians presented here will be described using the general case
of Linear time-variant systems. To change these into LTI (time-invariant
equations), the following substitutions can be used:

$$\phi(t, \tau) \to e^{A(t-\tau)}$$

$$\phi'(t, \tau) \to e^{A'(t-\tau)}$$

Where we are using the notation X\' to denote the transpose of a matrix
X (as opposed to the traditional notation X^T^).

### Reachability Gramian

We can define the **reachability gramian** as the following integral:

$$W_r(t_0, t_1) = \int_{t_0}^{t_1}\phi(t_1, \tau)B(\tau)B'(\tau)\phi'(t_1, \tau)d\tau$$

The system is reachable if the rank of the reachability gramian is the
same as the rank of the system matrix:

$$\operatorname{rank}(W_r) = p$$ `<chemistry>`{=html}/control{range}

### Controllability Gramian

We can define the **controllability gramian** of a system (A, B) as:

$$W_c(t_0, t_1) = \int_{t_0}^{t_1}\phi(t_0, \tau)B(\tau)B'(\tau)\phi'(t_0, \tau)d\tau$$

The system is controllable if the rank of the controllability gramian is
the same as the rank of the system matrix:

$$\operatorname{rank}(W_c) = p$$

If the system is time-invariant, there are two important points to be
made. First, the reachability gramian and the controllability gramian
reduce to be the same equation. Therefore, for LTI systems, if we have
found one gramian, then we automatically know both gramians. Second, the
controllability gramian can also be found as the solution to the
following Lyapunov equation:

$$AW_c + W_cA' = -BB'$$

Many software packages, notably MATLAB, have functions to solve the
Lyapunov equation. By using this last relation, we can also solve for
the controllability gramian using these existing functions.

## Observability

The state-variables of a system might not be able to be measured for any
of the following reasons:

1.  The location of the particular state variable might not be
    physically accessible (a capacitor or a spring, for instance).
2.  There are no appropriate instruments to measure the state variable,
    or the state-variable might be measured in units for which there
    does not exist any measurement device.
3.  The state-variable is a derived \"dummy\" variable that has no
    physical meaning.

If things cannot be directly observed, for any of the reasons above, it
can be necessary to calculate or **estimate** the values of the internal
state variables, using only the input/output relation of the system, and
the output history of the system from the starting time. In other words,
we must ask whether or not it is possible to determine what the inside
of the system (the internal system states) is like, by only observing
the outside performance of the system (input and output)? We can provide
the following formal definition of mathematical observability:

A system state x~i~ is unobservable at a given time t~i~ if the
zero-input response of the system is zero for all time t. If a system is
observable, then the only state that produces a zero output for all time
is the zero state. We can use this concept to define the term
**state-observability**.

### Constructability

A state *x* is **unconstructable** at a time t~1~ if for every finite
time t \< t~1~ the zero input response of the system is zero for all
time t.

A system is completely **state constructable** at time t~1~ if the only
state *x* that is unconstructable at t~0~ is *x* = 0.

If a system is observable at an initial time t~0~, then it is
constructable at some time t \> t~0~, if it is constructable at t~1~.

### Observability Matrix

The observability of the system is dependent only on the system states
and the system output, so we can simplify our state equations to remove
the input terms:

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

$$y(t) = Cx(t)$$

Therefore, we can show that the observability of the system is dependent
only on the coefficient matrices A and C. We can show precisely how to
determine whether a system is observable, using only these two matrices.
If we have the **observability matrix** Q:

$$Q = \begin{bmatrix}C\\CA\\CA^2\\\vdots\\CA^{p-1}\end{bmatrix}$$

we can show that the system is observable if and only if the Q matrix
has a rank of *p*. Notice that the Q matrix has the dimensions *pr* ×
*p*.

MATLAB allows one to easily create the observability matrix with the
**obsv** command. To create the observability matrix $Q$ simply type

:   Q=obsv(A,C)

where A and C are mentioned above. Then in order to determine if the
system is observable or not one can use the rank command to determine if
it has full rank.

### Observability Gramian

We can define an **observability gramian** as:

$$W_o(t_0, t_1) = \int_{t_0}^{t_1} \phi'(\tau, t_0)C'(\tau)C(\tau)\phi(\tau, t_0)d\tau$$

A system is completely state observable at time t~0~ \< t \< t~1~ if and
only if the rank of the observability gramian is equal to the size *p*
of the system matrix A.

If the system (A, B, C, D) is time-invariant, we can construct the
observability gramian as the solution to the Lyapunov equation:

$$A'W_o + W_oA = -C'C$$

### Constructability Gramian

We can define a **constructability gramian** as:

$$W_{cn}(t_0, t_1) = \int_{t_0}^{t_1} \phi'(\tau, t_1)C'(\tau)C(\tau)\phi(\tau, t_1)d\tau$$

A system is completely state observable at an initial time t~0~ if and
only if there exists a finite t~1~ such that:

$$\operatorname{rank} (W_0) = \operatorname{rank} (W_{cn}) = p$$

Notice that the constructability and observability gramians are very
similar, and typically they can both be calculated at the same time,
only substituting in different values into the state-transition matrix.

## Duality Principle

The concepts of controllability and observability are very similar. In
fact, there is a concrete relationship between the two. We can say that
a system (A, B) is controllable if and only if the system (A\', C, B\',
D) is observable. This fact can be proven by plugging A\' in for A, and
B\' in for C into the observability Gramian. The resulting equation will
exactly mirror the formula for the controllability gramian, implying
that the two results are the same.


# Control Systems/System Specifications

## System Specification

There are a number of different specifications that might need to be met
by a new system design. In this chapter we will talk about some of the
specifications that systems use, and some of the ways that engineers
analyze and quantify technical systems.

## Steady-State Accuracy

## Sensitivity

The **sensitivity** of a system is a parameter that is specified in
terms of a given output and a given input. The sensitivity measures how
much change is caused in the output by small changes to the reference
input. Sensitive systems have very large changes in output in response
to small changes in the input. The sensitivity of system H to input X is
denoted as:

$$S_H^X(s)$$

## Disturbance Rejection

All physically-realized systems have to deal with a certain amount of
noise and disturbance. The ability of a system to reject the noise is
known as the **disturbance rejection** of the system.

## Control Effort

The control effort is the amount of energy or power necessary for the
controller to perform its duty.


# Control Systems/State Feedback

## State Observation

The state space model of a system is the model of a single plant, not a
true feedback system. The feedback mechanism that relates *x\'* to *x*
is a representation of the mechanism internal to the plant, where the
state of the plant is related to its derivative. As such, we do not have
an *A* \"component\" in the sense that we can swap one *A* \"chip\" with
another *A* \"chip\". The entire state-space model, incorporating *A*,
*B*, *C*, and *D* are all part of one device. Frequently, these matrices
are immutable, that is that they cannot be altered by the engineer,
because they are intrinsic parts of the plant. However, these matrices
can change if the plant itself is altered, such as through thermal
effects and RF interference.

If the system can be treated as basically immutable (except for effects
out of the engineers control), then we need to find a way to modify the
system *externally*. From our studies in classical controls, we know
that the best system for such modifications is a feedback loop. What we
would like to do, ultimately, is to add an additional feedback element,
*K* that can be used to move the poles of the system to any desired
location. Using a technique called \"state feedback\" on a controllable
system, we can do just that.

## State Feedback

In **state feedback**, the value of the state vector is fed back to the
input of the system. We define a new input, *r*, and define the
following relationship:

$$u(t) = r(t) + Kx(t)$$

*K* is a constant matrix that is external to the system, and therefore
can be modified to adjust the locations of the poles of the system. This
technique can only work if the system is controllable.

### Closed-Loop System

If we have an external feedback element *K*, the system is said to be a
**closed-loop system**. Without this feedback element, the system is
said to be an **open-loop system**. Using the relationship we\'ve
outlined above between *r* and *u*, we can write the equations for the
closed-loop system:

$$x' = Ax + B(r + Kx)$$

$$x' = (A + BK)x + Br$$

Now, our closed-loop state equation appears to have the same form as our
open loop state equation, except that the sum *(A + BK)* replaces the
matrix *A*. We can define the closed-loop state matrix as:

$$A_{cl} = (A_{ol} + BK)$$

*A~cl~* is the closed-loop state matrix, and *A~ol~* is the open-loop
state matrix. By altering *K*, we can change the eigenvalues of this
matrix, and therefore change the locations of the poles of the system.
If the system is controllable, we can find the characteristic equation
of this system as:

$$\alpha(s) = |sI - A_{cl}| = |sI - (A_{ol} + BK)|$$

Computing the determinant is not a trivial task, the determinant of that
matrix can be very complicated, especially for larger systems. However,
if we transform the system into **controllable canonical form**, the
calculations become much easier. Another alternative to compute *K* is
by **Ackermann\'s Formula**.

### Controllable Canonical Form

### Ackermann\'s Formula

Consider a linear feedback system with no reference input:

$$u(t) = -Kx(t)$$

where *K* is a vector of gain elements. Systems of this form are
typically referred to as **regulators**. Notice that this system is a
simplified version of the one we introduced above, except that we are
ignoring the reference input. Substituting this into the state equation
gives us:

$$x' = Ax - BKx$$

**Ackermann\'s Formula** (by Jürgen Ackermann) gives us a way to select
these gain values *K* in order to control the location\'s of the system
poles. Using Ackermann\'s formula, if the system is controllable, we can
select arbitrary poles for our regulator system.

$$K = \begin{bmatrix}0 & 0 & \cdots & 1\end{bmatrix}\zeta^{-1}a(z)$$

where *a(z)* is the desired characteristic equation of the system and ζ
is the controllability matrix of the original system.

The gain *K* can be computed in MATLAB using Ackermann\'s formula with
the following command:

`K=acker(A, B, p);`

where K is the state feedback gain and *p* is the desired closed-loop
pole locations. The goal of this type of regulator is to drive the state
vector to zero. By using a reference input instead of a linear state
feedback, we can use the same kind of idea to drive the state vector to
any arbitrary state, and to give the system arbitrary poles.

### Reference Inputs

The idea of the system above with a linear feedback and no reference
input is to drive the system state vector to zero. If we have a system
reference input *r*, we can define a vector *N* that is the desired
value for our state. This combined input is equal to:

$$rN = x_r$$

where *x~r~* is the reference state we want our state *x* to reach. Here
is a block diagram of a system that uses this kind of state reference:

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

We have our gain matrix, *K*, and our reference input *rN*.
Mathematically, we can show that:

$$u = -K(x - x_r)$$

In this system, assuming the system is type 1 or higher, we can prove
that

$$x(\infty) = x_r$$

The state will approach the reference state as time approaches infinity.

The Reference Input is calculated in the continuous domain using the
below equations:

$\left[ \begin{matrix}N_x \\ N_u\end{matrix} \right]=\left[ \begin{matrix}A & B \\ C & D\end{matrix} \right]^{-1} \left[ \begin{matrix}0 \\ 1\end{matrix} \right]$

and $\bar{N}=N_u+KN_x$


# Control Systems/Estimators and Observers

## Estimators and Observers

A problem arises in which the internal states of many systems cannot be
directly observed, and therefore state feedback is not possible. What we
can do is try to design a separate system, known as an **observer** or
an **estimator** that attempts to duplicate the values of the state
vector of the plant, except in a way that is observable for use in state
feedback. Some literature calls these components \"observers\", although
they do not strictly observe the state directly. Instead, these devices
use mathematical relations to try and determine an estimate of the
state. Therefore, we will use the term \"estimator\", although the terms
may be used interchangeably.

### Creating an Estimator

There are several observer structures including Kalman\'s, sliding mode,
high gain, Tau\'s, extended, cubic and linear observers. To illustrate
the basics of observer design, consider a linear observer used to
estimate the state of a linear system. Notice that we know the *A*, *B*,
*C*, and *D* matrices of our plant, so we can use these exact values in
our estimator. We know the input to the system, we know the output of
the system, and we have the system matrices of the system. What we do
not know, necessarily, are the initial conditions of the plant. What the
estimator tries to do is make the estimated state vector approach the
actual state vector quickly, and then mirror the actual state vector. We
do this using the following system for an observer:

$$\hat{x}' = A\hat{x} + Bu + L(y - \hat{y})$$

$$\hat{y} = C\hat{x} + Du$$

*L* is a matrix that we define that will help drive the error to zero,
and therefore drive the estimate to the actual value of the state. We do
this by taking the difference between the plant output and the estimator
output.

![](State_Feedback_with_Estimator.svg "State_Feedback_with_Estimator.svg"){width="500"}

In order to make the estimator state approach the plant state, we need
to define a new additional state vector called *state error signal*
$e_x(t)$. We define this error signal as:

$$e_x(t) = x - \hat{x}$$

and its derivative:

$$e_x'(t) = x' - \hat{x}'$$

We can show that the error signal will satisfy the following
relationship:

$$e_x'(t) = Ax + Bu - (A\hat{x} + Bu + L(y - \hat{y}))$$

$$e_x'(t) = A(x- \hat{x}) - L(Cx - C\hat{x})$$

$$e_x'(t) = (A - LC)e_x(t)$$

We know that if the eigenvalues of the matrix *(A - LC)* all have
negative real parts that:

$$e_x(t) = e^{(A - LC)(t-t_0)}e_x(t_0) \to 0$$ when $t \to \infty$. This
$e_x(\infty) = 0$ means that the difference between the state of the
plant $x(t)$ and the estimated state of the observer $\hat{x}(t)$ tends
to fade as time approaches infinity.

### Separation Principle

We have two equations:

$$e_x[k + 1] = (A - LC)e_x[k]$$

$$x[k + 1] = (A - BK)x[k] + BK \cdot e_x[k]$$

We can combine them into a single system of equations to represent the
entire system:

$$\begin{bmatrix}e_x[k + 1] \\ x[k + 1]\end{bmatrix} = \begin{bmatrix}A - LC & 0 \\ +BK & A - BK\end{bmatrix} \begin{bmatrix}e_x[k] \\ x[k]\end{bmatrix}$$

We can find the characteristic equation easily using the **separation
principle**. We take the Z-Transform of this digital system, and take
the determinant of the coefficient matrix to find the characteristic
equation. The characteristic equation of the whole system is: (remember
the well known $(zI-A)^{-1}$)

$$\begin{vmatrix}zI - A + LC & 0 \\ -BK & zI - A + BK\end{vmatrix} = |zI - A + LC| |zI - A + BK|$$

Notice that the determinant of the large matrix can be broken down into
the product of two smaller determinants. The first determinant is
clearly the characteristic equation of the estimator, and the second is
clearly the characteristic equation of the plant. Notice also that we
can design the *L* and *K* matrices independently of one another.

It is worth mentioning that if the order of the system is *n*, this
characteristic equation (full-order state observer plus original system)
becomes of order *2n* and so has twice the number of roots of the
original system.

### The L Matrix

You should select the *L* matrix in such a way that the error signal is
driven towards zero as quickly as possible. The transient response of
the estimator, that is the amount of time it takes the error to
approximately reach zero, should be significantly shorter than the
transient response of the plant. The poles of the estimator should be,
by rule of thumb, at least 2-6 times faster then the poles of your
plant. As we know from our study of classical controls, to make a pole
faster we need to:

S-Domain:Move them further away from the imaginary axis (in the Left Half Plane!).\
Z-Domain:Move them closer to the origin.

Notice that in these situations, the faster poles of the estimator will
have less effect on the system, and we say that the plant poles dominate
the response of the system. The estimator gain *L* can be computed using
the dual of **Ackerman\'s formula** for selecting the gain *K* of the
state feedback controller:

$$L = \alpha_e(z)Q\begin{bmatrix}0\\0\\ \vdots \\1\end{bmatrix}$$

Where *Q* is the observability matrix of the plant, and α~e~ is the
characteristic equation of your estimator.

This can be computed in MATLAB with the following command:

`L=acker(A', C', K)';`

where L is the estimator gain and K is the poles for the estimator.

### Composite System

Once we have our *L* and *K* matrices, we can put these together into a
single composite system equation for the case of state-feedback and zero
input:

$$\begin{bmatrix}x[n + 1]\\ \bar{x}[n+1]\end{bmatrix} = \begin{bmatrix} A & -BK \\ LH & A - BK - LH\end{bmatrix} \begin{bmatrix}x[n] \\ \bar{x}[n]\end{bmatrix}$$

$$u[n] = -K \bar{x}[n]$$

Taking the Z-Transform of this discrete system and solving for an
input-output relation gives us:

$$\frac{U(z)}{Y(z)} = -K[zI - A + BK +L C]^{-1}L$$

Notice that this is not the same as the transfer function, because the
input is on top of the fraction and the output is on bottom. To get the
transfer function from this equation we need to take the inverse of both
sides. The determinant of this inverse will then be the characteristic
equation of the composite system.

Notice that this equation gives us the ability to derive the system
input that created the particular output. This will be valuable later.

## Reduced-Order Observers

In many systems, at least one state variable can be either measured
directly, or calculated easily from the output. This can happen in the
case where the *C* matrix has only a single non-zero entry per system
output.

If one or more state variables can be measured or observed directly, the
system only requires a **reduced-order observer**, that is an observer
that has a lower order than the plant. The reduced order observer can
estimate the unmeasurable states, and a direct feedback path can be used
to obtain the measured state values.


# Control Systems/Eigenvalue Assignment for MIMO Systems

The design of control laws for MIMO
systems are more extensive in
comparison to SISO systems because the additional inputs ($q > 1$) offer
more options like defining the Eigenvectors or handling the activity of
inputs. This also means that the feedback matrix *K* for a set of
desired Eigenvalues of the closed-loop system is **not unique**. All
presented methods have advantages, disadvantages and certain
limitations. This means not all methods can be applied on every possible
system and it is important to check which method could be applied on the
own considered problem.

# Parametric State Feedback

A simple approach to find the feedback matrix *K* can be derived via
parametric state feedback (in German: *vollständige modale Synthese*). A
MIMO system

$$\dot{x}(t) = A x(t) + B u(t)$$

with input vector

$$u(t) = (u_{1}(t), u_{2}(t), \cdots, u_{q}(t)) = -K ~ x(t)$$

input matrix $B \in \mathbb{R}^{p \times q}$ and feedback matrix
$K \in \mathbb{R}^{q \times p}$ is considered. The Eigenvalue problem of
the closed-loop system

$$\dot{x}(t) = (A - B~K) ~ x(t) = A_{CL} ~ x(t)$$

is noted as

$$A_{CL} ~ \tilde{v}_{i} = (A - B~K) ~ \tilde{v}_{i}   = \tilde{\lambda}_{i} ~ \tilde{v}_{i}$$

where $\tilde{\lambda}_{i} \in \mathbb{C}$ denote the assigned
Eigenvalues and $\tilde{v}_{i} \in \mathbb{C}^{p}$ denote the
Eigenvectors of the closed-loop system. Next, new parameter vectors
$\phi_{i} = K \tilde{v}_{i}$ are introduced and assigned and the
Eigenvalue problem is recasted as

$$B~K ~ \tilde{v}_{i} = B ~ \phi_{i} = (A -  \tilde{\lambda}_{i} ~ I) ~ \tilde{v}_{i}.$$

## Controller synthesis

1\. From Equation \[1\] one defines the **Eigenvector** with

$$\tilde{v}_{i} = (A -  \tilde{\lambda}_{i} ~ I)^{-1} ~ B ~ \phi_{i}$$

2\. The new parameter vectors $\phi_{i}$ are concatenated as

$$\Phi = [\phi_{1}, \phi_{2}, \cdots, \phi_{p}] = K [\tilde{v}_{1}, \tilde{v}_{2}, \cdots, \tilde{v}_{p}],$$

where the **feedback matrix** *K* can be noted as

$$K = \Phi ~ [\tilde{v}_{1}, \tilde{v}_{2}, \cdots, \tilde{v}_{p}]^{-1}.$$

3\. Finally, the Eigenvector definition is used to hold the full
description of the **feedback matrix** with

$$K = [\phi_{1}, \phi_{2}, \cdots, \phi_{p}] ~ [(A -  \tilde{\lambda}_{1} ~ I)^{-1} ~ B ~ \phi_{1}, \cdots, (A -  \tilde{\lambda}_{p} ~ I)^{-1} ~ B ~ \phi_{p}]^{-1}.$$

The parameter vectors are defined arbitrarily but have to be linear
independent.

## Remarks

-   Method works for non-quadratic B
-   Parameter vectors $\phi_{i}$ can be chosen arbitrarily

## Example

# Singular Value Decomposition and Diagonalization

If the state matrix $A \in \mathbb{R}^{p \times p}$ of system

$$\dot{x}(t) = A ~ x(t) + B ~ u(t)$$

is diagonalizable, which means the number of Eigenvalues and
Eigenvectors are equal, then the transform

$$x = M ~ x_{M}$$

can be used to yield

$$M ~ \dot{x}_{M}(t) = A M ~ x_{M}(t) + B ~ u(t)$$

and further

$$\dot{x}_{M}(t) = M^{-1} A M ~ x_{M}(t) + M^{-1} ~ B ~ u(t).$$

Transformation matrix *M* contains the Eigenvectors
$v_{i} \in \mathbb{C}^{p}$ as

$$M = [v_{1}, v_{2}, \cdots, v_{p}]$$

which leads to a new diagonal state matrix

$$A_{M} = M^{-1} ~ A ~ M =
\begin{bmatrix}
\lambda_{1} \\
& \lambda_{2} \\
& & \ddots \\
& & & \lambda_{p}
\end{bmatrix}$$ consisting of Eigenvalues $\lambda_{i}  \in \mathbb{C}$,
and new input

$$u_{M}(t) = M^{-1} ~ B ~ u(t) =
\begin{bmatrix}
u_{M,1} \\
u_{M,2}  \\
\cdots \\
u_{M,p}
\end{bmatrix}.$$

The control law for the new input $u_{M}$ is designed as

$$u_{M}(t) = -K_{M} x_{M}(t) =
-
\begin{bmatrix}
K_{M,1} \\
& K_{M,2} \\
& & \ddots \\
& & & K_{M,p}
\end{bmatrix}
~
\begin{bmatrix}
x_{M,1}(t) \\
x_{M,2}(t)  \\
\cdots \\
x_{M,p}(t)
\end{bmatrix}$$

and the closed-loop system in new coordinates is noted as

$$\dot{x}_{M}(t) =  A_{M} ~ x_{M}(t) + u_{M}(t) = (A_{M} - K_{M}) ~ x_{M}(t) =
\begin{bmatrix}
\lambda_{1} - K_{M,1} \\
& \lambda_{2} - K_{M,2} \\
& & \ddots \\
& & & \lambda_{p} - K_{M,p}
\end{bmatrix}
~
\begin{bmatrix}
x_{M,1}(t) \\
x_{M,2}(t)  \\
\cdots \\
x_{M,p}(t)
\end{bmatrix}$$

Feedback matrix $K_{M}$ can be used to influence or shift each
Eigenvalue directly.

In the last step, the new input is transformed backwards to original
coordinates to yield the original feedback matrix *K*. The new input is
defined by

$$u_{M}(t) = M^{-1} ~ B ~ u(t)$$

and

$$u_{M}(t) = -K_{M} ~ x_{M}(t) = -K_{M} ~ M^{-1} ~ x(t).$$

From these formulas one gains the identity

$$M^{-1} ~ B ~ u(t) = -K_{M} ~ M^{-1} ~ x(t)$$

and further

$$u(t) = - B^{-1} ~ M ~ K_{M} ~ M^{-1} ~ x(t) = - K ~ x(t).$$

Therefore, the feedback matrix is found as

$$K = B^{-1} ~ M ~ K_{M} ~ M^{-1}.$$

## Requirements

This controller design is applicable only if the following requirements
are guaranteed.

-   State matrix *A* is
    diagonalizable.
-   The number of states and inputs are equal $p=q$.
-   Input matrix $B \in \mathbb{R}^{p \times p}$ is invertible.

## Example

{2}\\\\ \\frac{\\sqrt{2}}{2} \\end{bmatrix} `</math>`{=html}

and

$$\tilde{v}_{2} =
\begin{bmatrix}
\frac{\sqrt{2}}{2}\\
\frac{\sqrt{2}}{2}
\end{bmatrix}.$$

Thus, the transformation matrix is noted as

$$M =
\begin{bmatrix}
-\frac{\sqrt{2}}{2} & \frac{\sqrt{2}}{2} \\
\frac{\sqrt{2}}{2} & \frac{\sqrt{2}}{2}
\end{bmatrix}$$

and the state matrix in new coordinates is derived as

$$A_{M} = M^{-1} ~ A ~ M =
\begin{bmatrix}
1 & 0 \\
0 & 3
\end{bmatrix}.$$

The desired Eigenvalues of the closed-loop system are
$\tilde{\lambda}_{1} = -5$ and $\tilde{\lambda}_{2} = -1$, so feedback
matrix is found with

$$\lambda_{1} - K_{M,1} = 1 - K_{M,1} = \tilde{\lambda}_{1} = -5 \quad \Rightarrow  K_{M,1} = 1 + 5 = 6$$

and

$$\lambda_{2} - K_{M,2} = 3 - K_{M,1} = \tilde{\lambda}_{2} = -1 \quad \Rightarrow  K_{M,2} = 3 + 1 = 4$$

and thus one holds

$$K_{M} =
\begin{bmatrix}
6 & 0 \\
0 & 4 \\
\end{bmatrix}.$$

Finally, the feedback matrix in original coordinates are calculated by

$$K = B^{-1} ~ M ~ K_{M} ~ M^{-1} =
\begin{bmatrix}
1 & 2 \\
2 & 1
\end{bmatrix}^{-1}
~
\begin{bmatrix}
-\frac{\sqrt{2}}{2} & \frac{\sqrt{2}}{2} \\
\frac{\sqrt{2}}{2} & \frac{\sqrt{2}}{2}
\end{bmatrix}
~
\begin{bmatrix}
6 & 0 \\
0 & 4 \\
\end{bmatrix}
~
\begin{bmatrix}
-\frac{\sqrt{2}}{2} & \frac{\sqrt{2}}{2} \\
\frac{\sqrt{2}}{2} & \frac{\sqrt{2}}{2}
\end{bmatrix}^{-1}
= \frac{1}{3}
\begin{bmatrix}
-7 & 11 \\
11 & -7 \\
\end{bmatrix} .$$ }}

# Sylvester Equation

This method is taken from the online resource

-   KU Leuven: Chapter 3: State Feedback - Pole Placement (PDF, 308,5
    kB) (does not exist
    anymore).
-   Similar resource: Chapter 4 Pole placement (PDF, 269,3
    kB) by Zsófia Lendek

Consider the closed-loop system

$$\dot{x}(t) = A ~ x(t) + B ~ u(t) = (A - B ~ K) ~ x(t) = A_{CL} ~ x(t)$$

with input $u(t) = -K ~ x(t)$ and closed-loop state matrix
$A_{CL}=A - B ~ K$. The desired closed-loop Eigenvalues
$\tilde{\lambda}_{i} \in \mathbb{C}$ can be chosen real- or
complex-valued as $\tilde{\lambda}_{i} = \alpha_{i} \pm j \beta_{i}$ and
the matrix of the desired Eigenvalues is noted as

$$\Lambda =
\begin{bmatrix}
\alpha_{1} & \beta_{1} \\
-\beta_{1} & \alpha_{1} \\
& & \ddots \\
& & & \tilde{\lambda}_{i} \\
& & & & \ddots
\end{bmatrix}$$

The closed-loop state matrix $A_{CL}$ has to be similar to $\Lambda$ as

$$A_{CL} = A - B~K \sim \Lambda$$

which means that there exists a transformation matrix
$M \in \mathbb{R}^{p \times p}$ such that

$$M^{-1}~A_{CL}~M = M^{-1} ~(A - B~K)~M = \Lambda$$

holds and further

$$A~M - M~\Lambda = B~K~M.$$

An arbitrary Matrix $G = K~M$ is introduced and Equation \[2\] is
separated in a Sylvester equation

$$A~M - M~\Lambda = B~G$$

and a feedback matrix formula

$$K = G ~ M^{-1}.$$

## Algorithm

1\. Choose an arbitrary matrix $G \in \mathbb{R}^{q \times p}$.

2\. Solve the Sylvester equation for *M* (numerically).

3\. Calculate the feedback matrix *K*.

## Remarks

-   State matrix *A* and the negative Eigenvalue matrix $-\Lambda$ shall
    not have common Eigenvalues.
-   For some choices of *G* the computation could fail. Then another *G*
    has to be chosen.

## Example


# Control Systems/Controllers and Compensators

## Controllers

There are a number of different standard types of control systems that
have been studied extensively. These controllers, specifically the P,
PD, PI, and PID controllers are very common in the production of
physical systems, but as we will see they each carry several drawbacks.

## Proportional Controllers

center\|framed\|A Proportional controller block
diagram

Proportional controllers are simply gain values. These are essentially
multiplicative coefficients, usually denoted with a *K*. A P controller
can only force the system poles to a spot on the system\'s root locus. A
P controller cannot be used for arbitrary pole placement.

We refer to this kind of controller by a number of different names:
proportional controller, gain, and zeroth-order controller.

## Derivative Controllers

center\|framed\|A Proportional-Derivative controller block
diagram

In the Laplace domain, we can show the derivative of a signal using the
following notation:

$$D(s) = \mathcal{L} \left\{ f'(t) \right\} = sF(s) - f(0)$$

Since most systems that we are considering have zero initial condition,
this simplifies to:

$$D(s) = \mathcal{L} \left\{ f'(t) \right\} = sF(s)$$

The derivative controllers are implemented to account for future values,
by taking the derivative, and controlling based on where the signal is
going to be in the future. Derivative controllers should be used with
care, because even small amount of high-frequency noise can cause very
large derivatives, which appear like amplified noise. Also, derivative
controllers are difficult to implement perfectly in hardware or
software, so frequently solutions involving only integral controllers or
proportional controllers are preferred over using derivative
controllers.

Notice that derivative controllers are not proper systems, in that the
order of the numerator of the system is greater than the order of the
denominator of the system. This quality of being a non-proper system
also makes certain mathematical analysis of these systems difficult.

### Z-Domain Derivatives

We won\'t derive this equation here, but suffice it to say that the
following equation in the Z-domain performs the same function as the
Laplace-domain derivative:

$$D(z) = \frac{z - 1}{Tz}$$

Where T is the sampling time of the signal.

## Integral Controllers

center\|framed\|A Proportional-Integral Controller block
diagram

To implemenent an Integral in a Laplace domain transfer function, we use
the following:

$$\mathcal{L}\left\{ \int_0^t f(t)\, dt \right\} = {1 \over s}F(s)$$

Integral controllers of this type add up the area under the curve for
past time. In this manner, a PI controller (and eventually a PID) can
take account of the past performance of the controller, and correct
based on past errors.

### Z-Domain Integral

The integral controller can be implemented in the Z domain using the
following equation:

$$D(z) = \frac{z + 1}{z - 1}$$

## PID Controllers

!A block diagram of a PID
controller

PID controllers are combinations of the proportional, derivative, and
integral controllers. Because of this, PID controllers have large
amounts of flexibility. We will see below that there are definite
limites on PID control.

{{-}}

### PID Transfer Function

The transfer function for a standard PID controller is an addition of
the Proportional, the Integral, and the Differential controller transfer
functions (hence the name, PID). Also, we give each term a gain
constant, to control the weight that each factor has on the final
output:

$$D(s) = K_p + {K_i \over s} + K_d s$$

Notice that we can write the transfer function of a PID controller in a
slightly different way:

$$D(s) = \frac{A_0 + A_1s}{B_0 + B_1s}$$

This form of the equation will be especially useful to us when we look
at polynomial design.

### PID Signal flow diagram

!Signal flow diagram for a PID
controller

### PID Tuning

The process of selecting the various coefficient values to make a PID
controller perform correctly is called **PID Tuning**. There are a
number of different methods for determining these values:[^1]

1\) Direct Synthesis (DS) method

2\) Internal Model Control (IMC) method

3\) Controller tuning relations

4\) Frequency response techniques

5\) Computer simulation

6\) On-line tuning after the control system is installed

7)Trial and error

**Notes:**

```{=html}
<references />
```
### Digital PID

In the Z domain, the PID controller has the following transfer function:

$$D(z) = K_p + K_i \frac{T}{2} \left[ \frac{z + 1}{z - 1} \right] + K_d \left[ \frac{z - 1}{Tz} \right]$$

And we can convert this into a canonical equation by manipulating the
above equation to obtain:

$$D(z) = \frac{a_0 + a_1 z^{-1} + a_2 z^{-2}}{1 + b_1 z^{-1} + b_2 z^{-2}}$$

Where:

$$a_0 = K_p + \frac{K_i T}{2} + \frac{K_d}{T}$$

$$a_1 = -K_p + \frac{K_i T}{2} + \frac{-2 K_d}{T}$$

$$a_2 = \frac{K_d}{T}$$

$$b_1 = -1$$

$$b_2 = 0$$

Once we have the Z-domain transfer function of the PID controller, we
can convert it into the digital time domain:

$$y[n] = x[n]a_0 + x[n-1]a_1 + x[n-2]a_2 - y[n-1]b_1 - y[n-2]b_2$$

And finally, from this difference equation, we can create a digital
filter structure to implement the PID.

## Bang-Bang Controllers

Despite the low-brow sounding name of the Bang-Bang controller, it is a
very useful tool that is only really available using digital methods. A
better name perhaps for a bang-bang controller is an on/off controller,
where a digital system makes decisions based on target and threshold
values, and decides whether to turn the controller on and off. Bang-bang
controllers are a non-linear style of control.

Consider the example of a household furnace. The oil in a furnace burns
at a specific temperature---it can\'t burn hotter or cooler. To control
the temperature in your house then, the thermostat control unit decides
when to turn the furnace on, and when to turn the furnace off. This
on/off control scheme is a bang-bang controller.

## Compensation

There are a number of different compensation units that can be employed
to help fix certain system metrics that are outside of a proper
operating range. Most commonly, the phase characteristics are in need of
compensation, especially if the magnitude response is to remain
constant. There are four major types of compensation 1. Lead
compensation 2. Lag compensation 3. Lead-lag compensation 4. Lag-lead
compensation

## Phase Compensation

Occasionally, it is necessary to alter the phase characteristics of a
given system, without altering the magnitude characteristics. To do
this, we need to alter the frequency response in such a way that the
phase response is altered, but the magnitude response is not altered. To
do this, we implement a special variety of controllers known as **phase
compensators**. They are called compensators because they help to
improve the phase response of the system.

There are two general types of compensators: **Lead Compensators**, and
**Lag Compensators**. If we combine the two types, we can get a special
**Lag-lead Compensator** system.(lead-lag system is not practically
realisable).

When designing and implementing a phase compensator, it is important to
analyze the effects on the gain and phase margins of the system, to
ensure that compensation doesn\'t cause the system to become unstable.
phase lead compensation:- 1 it is same as addition of zero to open loop
TF since from pole zero point of view zero is nearer to origin than pole
hence effect of zero dominant.

## Phase Lead

The transfer function for a lead-compensator is as follows:

$$T_{lead}(s) = \frac{s-z}{s-p}$$

To make the compensator work correctly, the following property must be
satisfied:

$$| z | < | p |$$

And both the pole and zero location should be close to the origin, in
the LHP. Because there is only one pole and one zero, they both should
be located on the real axis.

Phase lead compensators help to shift the poles of the transfer function
to the left, which is beneficial for stability purposes.

## Phase Lag

The transfer function for a lag compensator is the same as the
lead-compensator, and is as follows:

$$T_{lag}(s) = \frac{s-z}{s-p}$$

However, in the lag compensator, the location of the pole and zero
should be swapped:

$$| p | < | z |$$

Both the pole and the zero should be close to the origin, on the real
axis.

The Phase lag compensator helps to improve the steady-state error of the
system. The poles of the lag compensator should be very close together
to help prevent the poles of the system from shifting right, and
therefore reducing system stability.

## Phase Lag-lead

The transfer function of a **Lag-lead compensator** is simply a
multiplication of the lead and lag compensator transfer functions, and
is given as:

$$T_{Lag-lead}(s) = \frac{(s-z_1)(s-z_2)}{(s-p_1)(s-p_2)}.$$

Where typically the following relationship must hold true:

$$| p_1 | > | z_1 | > | z_2 | > | p_2 |$$

## External links

-   Standard Controller Forms on
    ControlTheoryPro.com
-   PID Control on
    ControlTheoryPro.com
-   PI Control on
    ControlTheoryPro.com

[^1]: Seborg, Dale E.; Edgar, Thomas F.; Mellichamp, Duncan A. (2003).
    Process Dynamics and Control, Second Edition. John Wiley & Sons,Inc.


# Control Systems/Polynomial Design

## Polynomial Design

A powerful tool for the design of controller and compensator systems is
**polynomial design**. Polynomial design typically consists of two
separate stages:

1.  Determine the desired response of the system
2.  Adjust your system to match the desired response.

We do this by creating polynomials, such as the transform-domain
transfer functions, and equating coefficients to find the necessary
values. The goal in all this is to be able to arbitrarily place all the
poles in our system at any locations in the transform domain that we
desire. In other words, we want to arbitrarily modify the response of
our system to match any desired response. The requirements in this
chapter are that the system be fully controllable and observable. If
either of these conditions are not satisfied, the techniques in this
method cannot be directly implemented.

Through this method it is assumed that the plant is given and is not
alterable. To adjust the response of the system, a controller unit needs
to be designed that helps the system meet the specifications. Because
the controller is being custom designed, the response of the controller
can be determined arbitrarily (within physical limits, of course).

## Polynomial Representation

Let\'s say that we have a plant, *G(s)*, and a controller, *C(s)*. Both
the controller and the plant are proper systems, composed of monic
numerator and denominator polynomials. The plant, *G(s)* has an order of
*n*, is given, and cannot be altered. The task is to design the
controller *C(s)* of order *m*:

$$G(s) = \frac{b(s)}{a(s)}$$

$$C(s) = \frac{B(s)}{A(s)}$$

Our closed-loop system, *H(s)* will have a transfer function of:

$$H(s) = \frac{C(s)G(s)}{1+C(s)G(s)} = \frac{B(s)b(s)}{A(s)a(s) + B(s)b(s)}$$

Our characteristic equation then is:

$$\alpha_H(s) = A(s)a(s) + B(s)b(s)$$

Our plant is given so we know *a(s)* and *b(s)*, but *A(s)* and *B(s)*
are configurable as part of our controller. To determine values for
these, we must select a desired response, that is the response that our
system *should have*. We call our desired response *D(s)*. We can
configure our controller to have our system match the desired response
by solving the **Diophantine equation**:

$$D(s) = A(s)a(s) + B(s)b(s)$$

### Diophantine Equation

The Diophantine equation becomes a system of linear equations in terms
of the unknown coefficients of the *A(s)* and *B(s)* polynomials. There
are situations where the Diophantine equation will produce a unique
result, but there are also situations where the results will be
non-unique.

We multiply polynomials, and then combine powers of *s*:

$$D(s) = (A_0a_0 + B_0b_0) +$$$(A_0a_1 + A_1a_0 + B_0b_1 + B_1b_0)s +$$\cdots + (A_ma_n + B_mb_n)s^{m + n}$

Now we can equate the coefficients of *D(s)* and our resultant system of
equations is given as:

$$\begin{bmatrix}
a_0 & b_0 & 0 & 0 & \cdots & 0 & 0 \\
a_1 & b_1 & a_0 & b_0 & \cdots & 0 & 0 \\
\vdots & \vdots & \vdots & \vdots & \ddots & \vdots & \vdots \\
a_n & b_n & a_{n-1} & b_{n-1} & \cdots & a_0 & b_0 \\
0 & 0 & a_n & b_n & \cdots & a_1 & b_1 \\
\vdots & \vdots & \vdots & \vdots & \ddots & \vdots & \vdots \\
0 & 0 & 0 & 0 & \cdots & a_n & b_n \end{bmatrix}\begin{bmatrix}A_0 \\ B_0 \\ A_1 \\ B_1 \\ \vdots \\ A_m \\ B_m \end{bmatrix} = \begin{bmatrix}D_0 \\ D_1 \\ \vdots \\ D_{n + m}\end{bmatrix}$$

This matrix can be a large one, but the pattern is simple: new
coefficients are shifted in from the left, and old coefficients are
shifted off to the right on each row.

### Conditions for Uniqueness

The diophantine matrix, which we will call *S*, has dimensions of *(n +
m + 1) × (2m + 2)*. The solution to this equation is unique if the
diophantine matrix is square, and therefore is invertable. If the matrix
has more columns then rows, the solution will be non-unique. If the
matrix has more rows then columns, the poles of the composite system
cannot be arbitrarily placed.

The condition for uniqueness can be satisfied if *m = n - 1*. The order
of the controller must be one less than the order of the plant. If the
order of the controller is higher, the solution will be non-unique. If
the order of the controller is lower, not all the poles can be
arbitrarily assigned.

### Example: Second Order System

### Example: Helicopter Control

Pole placement is the most straightforward means of controller design.
Here are the steps to designing a system using pole placement
techniques:

1.  The design starts with an assumption of what form the controller
    must take in order to control the given plant.
2.  From that assumption a symbolic characteristic equation is formed.
3.  At this point the desired closed-loop poles must be determined.
4.  Typically, specifications designate overshoot, rise time, etc. This
    leads to the formation of a 2nd order
    equation.
    Most of the time the final characteristic equation will have more
    than 2 poles. So additional desired poles must be determined.
5.  Once the closed loop poles are decided a desired characteristic
    equation is formed.
6.  The coefficients for each power of *s* are equated from the symbolic
    characteristic equation to the desired.
7.  Algebra is used to determine the controller coefficients necessary
    to achieve the desired closed-loop poles with the assumed controller
    form.

Typically, an integrator is used to drive the steady-state error towards
0. This implies that the final characteristic equation will have at
least 1 more pole than the uncontrolled system started with.

The following pole placement examples show you how to decide on the
desired closed-loop poles, determine the \"extra\" closed-loop poles,
and create a generic and PID
controller
to achieve those desired closed-loop poles.

\\right)}`</math>`{=html}

$$\tau_s=\frac{4.6}{\zeta\omega_n}$$

$$\tau_p=\frac{\pi}{\omega_n\sqrt{1-\zeta^2}}$$

where

$$M_p$$ is overshoot,

$$\tau_s$$ is 1% settling time, and

$$\tau_p$$ is time to peak.

Using the Overshoot equation we find that a common value,
$\zeta=\frac{1}{\sqrt{2}}$, provides an overshoot of only 4.3%.
Examination of the Time to Peak equation lets you know that a value of
$\omega_n=\sqrt{2}$ provides a peak time of $\pi$ seconds. However, a
little over 3 seconds is probably too slow. Let\'s shoot for 0.5 seconds
instead. This requires

$$\omega_n=\sqrt{2}\frac{\pi}{0.5}$$.

Recap

-   $\zeta=\zeta_{desired}=\frac{1}{\sqrt{2}}$
-   $\omega_{n}=\omega_{desired}=\sqrt{2}\frac{\pi}{0.5}=8.8858$

However, this leaves us with only 2 roots (poles) in our desired
characteristic equation. Since we want the above parameters to dominate
the closed loop system dynamics we choose a 3rd pole that is well above
the desired natural frequency.

$$\left(s+a\right)\left(s^2+2\zeta_{desired}\omega_{desired}s+\omega_{desired}^2\right)$$

where

-   $a=10\omega_{desired}$ is our 3rd pole.

This 3rd pole is a high frequency pole that allows the desired poles to
the dominate the closed-loop system response while allowing the desired
characteristic equation to have the correct number of poles.

Our desired characteristic equation, Eqn. 3, can be reduced to

$$\Phi_{desired}\left(s\right)=s^3+\left(2\zeta_{desired}\omega_{desired}+a\right)s^2+\left(\omega_{desired}^2+2\zeta_{desired}\omega_{desired}a\right)s+a\omega_{desired}^2$$

This results in

$$p_3=1$$

$$p_2=2\zeta_{desired}\omega_{desired}+a$$

$$p_1=\omega_{desired}^2+2\zeta_{desired}\omega_{desired}a$$

$$p_0=a\omega_{desired}^2$$

From here we go back to our characteristic equation (Eqn. **2a** or
**2b**) to determine

$$A_1=1$$

$$A_0=2\zeta_{desired}\omega_{desired}+a-2\zeta\omega_n$$

$$B_0=\frac{\left(a\omega_{desired}^2-A_0\omega_n^2\right)}{\omega_n^2}$$

$$B_1=\frac{\omega_{desired}^2+2\zeta_{desired}\omega_{desired}a-2\zeta\omega_nA_0-A_1\omega_n^2}{\omega_n^2}$$
}}

## Caveats

There are a number of problems that can arise from this method.

### Insufficient Order

If *K(s)* has a polynomial degree *m*, and *G(s)* has a polynomial
degree *n*, then our composite system *H(s)* will have a total degree of
*m + n*. If our controller does not have a high enough order, we will
not be able to arbitrarily assign every pole in our system. From state
space, we know that poles that cannot be arbitrarily assigned are called
uncontrollable. The addition of a controller of insufficient order can
make one or more poles in our system uncontrollable.

## External links

-   ControlTheoryPro.com article on Pole
    Placement


# Control Systems/Adaptive Control

## Adaptive Controllers

What we\'ve been studying up till this point are fixed systems, that is
systems that do not change over time. However, real-world applications
and experience tells us that the environment can change over time: New
noise can be added to a signal, the signal quality can be degraded, or
the specifications of the signals can be changed at the source.

There is a distinct need then for controllers which can modify
themselves to produce the same output regardless of changes to the
input. Herein lies the problem of **adaptive control**. We will
introduce some of the concepts in this chapter, and discuss them in
greater detail in future chapters.


# Control Systems/State Machines

## State Machines

Digital computers have a lot more power and flexibility to offer than
processing simple difference equations like the kind that we have been
looking at so far in our discrete cases. Computer systems are capable of
handling much more complicated digital control tasks, and they are also
capable of changing their algorithms in the middle of the processing
time. For tasks like this, we will employ **state-machines** to allow us
to dynamically control several aspects of a single problem with a single
computer.

A state machine, in its simplest form, is a system that performs
different actions, depending upon the state of the machine.

## State Diagrams

A state diagram depicts the different states of a state machine, and it
uses arrows to show which states can be reached, and what are the
conditions for reaching them.

### Example

Consider a common controls example of a movable cart that is attached to
a horizontal pole. This cart, like the print-head on a printer, is free
to travel back and forth across this pole at finite speeds. Dangling
from the cart is a pendulum that is capable of freely spinning 360
degrees around its pivot point.

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

As the cart moves back and forth across the horizontal pole, the
pendulum will swing side-to-side. In fact, if the cart moves quickly
enough, and in the correct pattern, the pendulum will actually swing up
over the top of the cart, and travel a full 360 degrees. The purpose of
this contraption is to swing the pendulum upwards so that it is standing
up vertically above the cart, and to balance it as such. There are then
two distinct stages of operation for our control system:

1.  we must swing the pendulum from directly downward, to standing
    vertical
2.  we must balance the pendulum vertically

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

## Computer Implementation


# Control Systems/Nonlinear Systems

## Nonlinear General Solution

A nonlinear system, in general, can be defined as follows:

$$x'(t) = f(t, t_0, x, x_0)$$

$$x(t_0) = x_0$$

Where *f* is a nonlinear function of the time, the system state, and the
initial conditions. If the initial conditions are known, we can simplify
this as:

$$x'(t) = f(t, x)$$

The general solution of this equation (or the most general form of a
solution that we can state without knowing the form of *f*) is given by:

$$x(t) = x_0 + \int_{t_0}^t f(\tau, x)d\tau$$

and we can prove that this is the general solution to the above equation
because when we differentiate both sides we get the origin equation.

### Iteration Method

The general solution to a nonlinear system can be found through a method
of infinite iteration. We will define *x*~n~ as being an iterative
family of indexed variables. We can define them recursively as such:

$$x_n(t) = x_0 + \int_{t_0}^t f(\tau, x_{n-1}(\tau))d\tau$$

$$x_1(t) = x_0$$

We can show that the following relationship is true:

$$x(t) = \lim_{n \to \infty}x_n(t)$$

The *x*~n~ series of equations will converge on the solution to the
equation as n approaches infinity.

### Types of Nonlinearities

Nonlinearities can be of two types:

1.  **Intentional non-linearity**: The non-linear elements that are
    added into a system. Eg: Relay
2.  **Incidental non-linearity**: The non-linear behavior that is
    already present in the system. Eg: Saturation

## Linearization

Nonlinear systems are difficult to analyze, and for that reason one of
the best methods for analyzing those systems is to find a linear
approximation to the system. Frequently, such approximations are only
good for certain operating ranges, and are not valid beyond certain
bounds. The process of finding a suitable linear approximation to a
nonlinear system is known as **linearization**.

![](Linear_Approximation_in_2D.svg "Linear_Approximation_in_2D.svg"){width="500"}

This image shows a linear approximation (dashed line) to a non-linear
system response (solid line). This linear approximation, like most, is
accurate within a certain range, but becomes more inaccurate outside
that range. Notice how the curve and the linear approximation diverge
towards the right of the graph.


# Control Systems/Common Nonlinearities

There are some nonlinearities that happen so frequently in physical
systems that they are called \"Common nonlinearities\". These common
nonlinearities include Hysteresis, Backlash, and Dead-zone.

## Hysteresis

Continuing with the example of a household thermostat, let\'s say that
your thermostat is set at 70 degrees (Fahrenheit). The furnace turns on,
and the house heats up to 70 degrees, and then the thermostat dutifully
turns the furnace off again. However, there is still a large amount of
residual heat left in the ducts, and the hot air from the vents on the
ground may not all have risen up to the level of the thermostat. This
means that after the furnace turns off, the house may continue to get
hotter, maybe even to uncomfortable levels.

So the furnace turns off, the house heats up to 80 degrees, and then the
air conditioner turns on. The temperature of the house cools down to 70
degrees again, and the A/C turns back off. However, the house continues
to cool down, and then it gets too cold, and the furnace needs to turn
back on.

As we can see from this example, a bang-bang controller, if poorly
designed, can cause big problems, and it can waste lots of energy. To
avoid this, we implement the idea of **Hysteresis**, which is a set of
threshold values that allow for overflow outputs. Implementing
hysteresis, our furnace now turns off when we get to 65 degrees, and the
house slowly warms up to 75 degrees, and doesn\'t turn on the A/C unit.
This is a far preferable solution.

## Backlash

•Backlash refers to the angle that the output shaft of a gearhead can
rotate without the input shaft moving. Backlash arises due to tolerance
in manufacturing; the gear teeth need some play to avoid jamming when
they mesh. An inexpensive gearhead may have backlash of a degree or
more, while more expensive precision gearheads have nearly zero
backlash. Backlash typically increases with the number of gear stages.
Some gear types, notably harmonic drive gears (see Section 26.1.2), are
specifically designed for near-zero backlash, usually by using flexible
elements.

E.g.: Mechanical gear.

## Dead-Zone

A dead-zone is a kind of non linearity in which the system doesn\'t
respond to the given input until the input reaches a particular level or
it can refer to a condition in which output becomes zero when the input
crosses certain limiting value.

## Inverse Nonlinearities

### Inverse Backlash

### Inverse Dead-Zone


# Control Systems/Noise Driven Systems

## Noise-Driven Systems

Systems frequently have to deal with not only the control input *u*, but
also a random noise input *v*. In some disciplines, such as in a study
of electrical communication systems, the noise and the data signal can
be added together into a composite input *r = u + v*. However, in
studying control systems, we cannot combine these inputs together, for a
variety of different reasons:

1.  The control input works to stabilize the system, and the noise input
    works to destabilize the system.
2.  The two inputs are independent random variables.
3.  The two inputs may act on the system in completely different ways.

As we will show in the next example, it is frequently a good idea to
consider the noise and the control inputs separately:

## Probability Refresher

We are going to have a brief refesher here for calculus-based
probability, specifically focusing on the topics that we will use in the
rest of this chapter.

### Expectation

The expectation operatior, **E**, is used to find the *expected, or mean
value* of a given random variable. The expectation operator is defined
as:

$$E[x] = \int_{-\infty}^\infty x f_x(x)dx$$

If we have two variables that are independent of one another, the
expectation of their product is zero.

### Covariance

The **covariance** matrix, *Q*, is the expectation of a random vector
times it\'s transpose:

$$E[x(t)x'(t)] = Q(t)$$

If we take the value of the *x* transpose at a different point in time,
we can calculate out the covariance as:

$$E[x(t)x'(s)] = Q(t)\delta(t-s)$$

Where δ is the impulse function.

## Noise-Driven System Description

We can define the state equation to a system incorporating a noise
vector *v*:

$$x'(t) = A(t)x(t) + H(t)u(t) +B(t)v(t)$$

For generality, we will discuss the case of a time-variant system.
Time-invariant system results will then be a simplification of the
time-variant case. Also, we will assume that *v* is a **gaussian random
variable**. We do this because physical systems frequently approximate
gaussian processes, and because there is a large body of mathematical
tools that we can use to work with these processes. We will assume our
gaussian process has zero-mean.

## Mean System Response

We would like to find out how our system will respond to the new noisy
input. Every system iteration will have a different response that varies
with the noise input, but the average of all these iterations should
converge to a single value.

For the system with zero control input, we have:

$$x'(t) = A(t)x(t) + B(t)v(t)$$

For which we know our general solution is given as:

$$x(t) = \phi(t, t_0)x_0 + \int_{t_0}^t \phi(t, \tau)B(\tau)v(\tau)d\tau$$

If we take the **expected value** of this function, it should give us
the expected value of the output of the system. In other words, we would
like to determine what the expected output of our system is going to be
by adding a new, noise input.

$$E[x(t)] = E[\phi(t, t_0)x_0] + E[\int_{t_0}^t \phi(t, \tau)B(\tau)v(\tau)d\tau]$$

In the second term of this equation, neither φ nor B are random
variables, and therefore they can come outside of the expectaion
operation. Since *v* is zero-mean, the expectation of it is zero.
Therefore, the second term is zero. In the first equation, φ is not a
random variable, but x~0~ does create a dependancy on the output of
*x*(t), and we need to take the expectation of it. This means that:

$$E[x(t)] = \phi(t, t_0)E[x_0]$$

In other words, the expected output of the system is, on average, the
value that the output would be if there were no noise. Notice that if
our noise vector *v* was not zero-mean, and if it was not gaussian, this
result would not hold.

## System Covariance

We are now going to analyze the covariance of the system with a noisy
input. We multiply our system solution by its transpose, and take the
expectation: `<small>`{=html}(this equation is long and might break onto
multiple lines)`</small>`{=html}

$$E[x(t)x'(t)] = E[\phi(t, t_0)x_0 + \int_{t_0}^t\phi(\tau, t_0)B(\tau)v(\tau)d\tau]$$$E[(\phi(t, t_0)x_0 + \int_{t_0}^t\phi(\tau, t_0)B(\tau)v(\tau)d\tau)']$

If we multiply this out term by term, and cancel out the expectations
that have a zero-value, we get the following result:

$$E[x(t)x'(t)] = \phi(t, t_0)E[x_0x_0']\phi'(t, t_0) = P$$

We call this result *P*, and we can find the first derivative of P by
using the chain-rule:

$$P'(t) = A(t)\phi(t, t_0)P_0\phi(t, t_0) + \phi(t, t_0)P_0\phi'(t, t_0)A'(t)$$

Where

$$P_0 = E[x_0x_0']$$

We can reduce this to:

$$P'(t) = A(t)P(t) + P(t)A'(t) + B(t)Q(t)B'(t)$$

In other words, we can analyze the system *without needing to calculate
the state-transition matrix*. This is a good thing, because it can often
be very difficult to calculate the state-transition matrix.

## Alternate Analysis

Let us look again at our general solution:

$$x(t) = \phi(t, t_0)x(t_0) + \int_{t_0}^t \phi(t, \tau)B(\tau)v(\tau)d\tau$$

We can run into a problem because in a gaussian distribution, especially
systems with high variance (especially systems with infinite variance),
the value of *v* can momentarily become undefined (approach infinity),
which will cause the value of *x* to likewise become undefined at
certain points. This is unacceptable, and makes further analysis of this
problem difficult. Let us look again at our original equation, with zero
control input:

$$x'(t) = A(t)x(t)+B(t)v(t)$$

We can multiply both sides by *dt*, and get the following result:

$$dx = A(t)x(t)dt + B(t)v(t)dt$$

We can define a new differential, *dw(t)*, which is an infinitesimal
function of time as:

$$dw(t) = v(t)dt$$

Now, we can integrate both sides of this equation:

$$x(t) = x(t_0) + \int_{t_0}^t A(\tau)x(\tau)d\tau + \int_{t_0}^tB(\tau)dw(\tau)$$
 However, this leads us to an
unusual place, and one for which we are (probably) not prepared to
continue further: in the third term on the left-hand side, we are
attempting to integrate with respect to a *function*, not a *variable*.
In this instance, the standard Riemann integrals that we are all
familiar with cannot solve this equation. There are advanced techniques
known as **Ito Calculus** however that can solve this equation, but
these methods are currently outside the scope of this book.


# Control Systems/Digital Control Systems

## Digital Systems

Digital systems, expressed previously as difference equations or
Z-Transform transfer functions can also be used with the state-space
representation. Also, all the same techniques for dealing with analog
systems can be applied to digital systems, with only minor changes.

## Digital Systems

For digital systems, we can write similar equations, using discrete data
sets:

$$x[k + 1] = Ax[k] + Bu[k]$$

$$y[k] = Cx[k] + Du[k]$$

### Zero-Order Hold Derivation

If we have a continuous-time state equation:

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

We can derive the digital version of this equation that we discussed
above. We take the Laplace transform of our equation:

$$X(s) = (sI - A)^{-1}Bu(s) + (sI - A)^{-1}x(0)$$

Now, taking the inverse Laplace transform gives us our time-domain
system, keeping in mind that the inverse Laplace transform of the *(sI -
A)* term is our state-transition matrix, Φ:

$$x(t) = \mathcal{L}^{-1}(X(s)) = \Phi(t - t_0)x(0) + \int_{t_0}^t\Phi(t - \tau)Bu(\tau)d\tau$$

Now, we apply a zero-order hold on our input, to make the system
digital. Notice that we set our start time *t~0~ = kT*, because we are
only interested in the behavior of our system during a single sample
period:

$$u(t) = u(kT), kT \le t \le (k+1)T$$

$$x(t) = \Phi(t, kT)x(kT) + \int_{kT}^t \Phi(t, \tau)Bd\tau u(kT)$$

We were able to remove *u(kT)* from the integral because it did not rely
on τ. We now define a new function, Γ, as follows:

$$\Gamma(t, t_0) = \int_{t_0}^t \Phi(t, \tau)Bd\tau$$

Inserting this new expression into our equation, and setting *t = (k +
1)T* gives us:

$$x((k + 1)T) = \Phi((k+1)T, kT)x(kT) + \Gamma((k+1)T, kT)u(kT)$$

Now Φ(T) and Γ(T) are constant matrices, and we can give them new names.
The *d* subscript denotes that they are digital versions of the
coefficient matrices:

$$A_d = \Phi((k+1)T, kT)$$

$$B_d = \Gamma((k+1)T, kT)$$

We can use these values in our state equation, converting to our bracket
notation instead:

$$x[k + 1] = A_dx[k] + B_du[k]$$

## Relating Continuous and Discrete Systems

Continuous and discrete systems that perform similarly can be related
together through a set of relationships. It should come as no surprise
that a discrete system and a continuous system will have different
characteristics and different coefficient matrices. If we consider that
a discrete system is the same as a continuous system, except that it is
sampled with a sampling time T, then the relationships below will hold.
The process of converting an analog system for use with digital hardware
is called **discretization**. We\'ve given a basic introduction to
discretization already, but we will discuss it in more detail here.

### Discrete Coefficient Matrices

Of primary importance in discretization is the computation of the
associated coefficient matrices from the continuous-time counterparts.
If we have the continuous system *(A, B, C, D)*, we can use the
relationship *t = kT* to transform the state-space solution into a
sampled system:

$$x(kT) = e^{AkT}x(0) + \int_0^{kT} e^{A(kT - \tau)}Bu(\tau)d\tau$$

$$x[k] = e^{AkT}x[0] + \int_0^{kT} e^{A(kT - \tau)}Bu(\tau)d\tau$$

Now, if we want to analyze the *k+1* term, we can solve the equation
again:

$$x[k+1] = e^{A(k+1)T}x[0] + \int_0^{(k+1)T} e^{A((k+1)T - \tau)}Bu(\tau)d\tau$$

Separating out the variables, and breaking the integral into two parts
gives us:

$$x[k+1] = e^{AT}e^{AkT}x[0] + \int_0^{kT}e^{AT}e^{A(kT - \tau)}Bu(\tau)d\tau + \int_{kT}^{(k+1)T} e^{A(kT + T - \tau)}Bu(\tau)d\tau$$

If we substitute in a new variable *β = (k + 1)T + τ*, and if we see the
following relationship:

$$e^{AkT}x[0] = x[k]$$

We get our final result:

$$x[k+1] = e^{AT}x[k] + \left(\int_0^T e^{A\alpha}d\alpha\right)Bu[k]$$

Comparing this equation to our regular solution gives us a set of
relationships for converting the continuous-time system into a
discrete-time system. Here, we will use \"d\" subscripts to denote the
system matrices of a discrete system, and we will use a \"c\" subscript
to denote the system matrices of a continuous system.

:   {\| class=\"wikitable\"

\|- \|$A_d = e^{A_cT}$ \|- \|$B_d = \int_0^Te^{A\tau}d\tau B_c$ \|-
\|$C_d = C_c$ \|- \|$D_d = D_c$ \|}

If the A~c~ matrix is nonsingular, and we can find it\'s inverse, we can
instead define B~d~ as:

$$B_d = A_c^{-1}(A_d - I)B_c$$

The differences in the discrete and continuous matrices are due to the
fact that the underlying equations that describe our systems are
different. Continuous-time systems are represented by linear
differential equations, while the digital systems are described by
difference equations. High order terms in a difference equation are
delayed copies of the signals, while high order terms in the
differential equations are derivatives of the analog signal.

If we have a complicated analog system, and we would like to implement
that system in a digital computer, we can use the above transformations
to make our matrices conform to the new paradigm.

### Notation

Because the coefficient matrices for the discrete systems are computed
differently from the continuous-time coefficient matrices, and because
the matrices technically represent different things, it is not uncommon
in the literature to denote these matrices with different variables. For
instance, the following variables are used in place of *A* and *B*
frequently:

$$\Omega = A_d$$

$$R = B_d$$

These substitutions would give us a system defined by the ordered
quadruple *(Ω, R, C, D)* for representing our equations.

As a matter of notational convenience, we will use the letters *A* and
*B* to represent these matrices throughout the rest of this book.

## Converting Difference Equations

## Solving for x\[n\]

We can find a general time-invariant solution for the discrete time
difference equations. Let us start working up a pattern. We know the
discrete state equation:

$$x[n+1] = Ax[n] + Bu[n]$$

Starting from time *n = 0*, we can start to create a pattern:

$$x[1] = Ax[0] + Bu[0]$$

$$x[2] = Ax[1] + Bu[1] = A^2x[0] + ABu[0] + Bu[1]$$

$$x[3] = Ax[2] + Bu[2] = A^3x[0] + A^2Bu[0] + ABu[1] + Bu[2]$$

With a little algebraic trickery, we can reduce this pattern to a single
equation:

$$x[n] = A^nx[n_0] + \sum_{m=0}^{n-1}A^{n-1-m}Bu[m]$$

Substituting this result into the output equation gives us:

$$y[n] = CA^nx[n_0] + \sum_{m=0}^{n-1}CA^{n-1-m}Bu[m] + Du[n]$$

## Time Variant Solutions

If the system is time-variant, we have a general solution that is
similar to the continuous-time case:

$$x[n] = \phi[n, n_0]x[n_0] + \sum_{m = n_0}^{n-1} \phi[n, m+1]B[m]u[m]$$

$$y[n] = C[n]\phi[n, n_0]x[n_0] + C[n]\sum_{m = n_0}^{n-1} \phi[n, m+1]B[m]u[m] + D[n]u[n]$$

Where φ, the **state transition matrix**, is defined in a similar manner
to the state-transition matrix in the continuous case. However, some of
the properties in the discrete time are different. For instance, the
inverse of the state-transition matrix does not need to exist, and in
many systems it does not exist.

### State Transition Matrix

The discrete time state transition matrix is the unique solution of the
equation:

$$\phi[k+1, k_0] = A[k] \phi[k, k_0]$$

Where the following restriction must hold:

$$\phi[k_0, k_0] = I$$

From this definition, an obvious way to calculate this state transition
matrix presents itself:

$$\phi[k, k_0] = A[k - 1]A[k-2]A[k-3]\cdots A[k_0]$$

Or,

$$\phi[k, k_0] = \prod_{m = 1}^{k-k_0}A[k-m]$$

## MATLAB Calculations

MATLAB is a computer program, and therefore calculates all systems using
digital methods. The MATLAB function **lsim** is used to simulate a
continuous system with a specified input. This function works by calling
the **c2d**, which converts a system *(A, B, C, D)* into the equivalent
discrete system. Once the system model is discretized, the function
passes control to the **dlsim** function, which is used to simulate
discrete-time systems with the specified input.

Because of this, simulation programs like MATLAB are subjected to
round-off errors associated with the discretization process.

## Sampler Systems

Let\'s say that we introduce a sampler into our system:

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

Notice that after the sampler, we must introduce a reconstruction
circuit (described elsewhere) so that we may continue to keep the input,
output, and plant in the laplace domain. Notice that we denote the
reconstruction circuit with the symbol: Gr(s).

The preceding was a particularly simple example. However, the reader is
encouraged to solve for the transfer function for a system with a
sampler (and it\'s associated reconstructor) in the following places:

1.  Before the feedback system
2.  In the forward path, after the plant
3.  In the reverse path
4.  After the feedback loop


# 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/System Delays

## Delays

A system can be built with an inherent **delay**. Delays are units that
cause a time-shift in the input signal, but that don\'t affect the
signal characteristics. An **ideal delay** is a delay system that
doesn\'t affect the signal characteristics at all, and that delays the
signal for an exact amount of time. Some delays, like processing delays
or transmission delays, are unintentional. Other delays however, such as
synchronization delays, are an integral part of a system. This chapter
will talk about how delays are utilized and represented in the Laplace
Domain. Once we represent a delay in the Laplace domain, it is an easy
matter, through change of variables, to express delays in other domains.

### Ideal Delays

An ideal delay causes the input function to be shifted forward in time
by a certain specified amount of time. Systems with an ideal delay cause
the system output to be delayed by a finite, predetermined amount of
time.

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

## Time Shifts

Let\'s say that we have a function in time that is time-shifted by a
certain constant time period *T*. For convenience, we will denote this
function as *x(t - T)*. Now, we can show that the Laplace transform of
*x(t - T)* is the following:

$$\mathcal{L}\{x(t - T)\} \Leftrightarrow e^{-sT}X(s)$$

What this demonstrates is that time-shifts in the time-domain become
exponentials in the complex Laplace domain.

### Shifts in the Z-Domain

Since we know the following general relationship between the Z Transform
and the Star Transform:

$$z \Leftrightarrow e^{sT}$$

We can show what a time shift in a discrete time domain becomes in the Z
domain:

$$x((n-n_s)\cdot T)\equiv x[n - n_s] \Leftrightarrow z^{-n_s}X(z)$$

## Delays and Stability

A time-shift in the time domain becomes an exponential increase in the
Laplace domain. This would seem to show that a time shift can have an
effect on the stability of a system, and occasionally can cause a system
to become unstable. We define a new parameter called the **time margin**
as the amount of time that we can shift an input function before the
system becomes unstable. If the system can survive any arbitrary time
shift without going unstable, we say that the time margin of the system
is infinite.

## Delay Margin

When speaking of sinusoidal signals, it doesn\'t make sense to talk
about \"time shifts\", so instead we talk about \"phase shifts\".
Therefore, it is also common to refer to the time margin as the **phase
margin** of the system. The phase margin denotes the amount of phase
shift that we can apply to the system input before the system goes
unstable.

We denote the phase margin for a system with a lowercase Greek letter φ
(phi). Phase margin is defined as such for a second-order system:

$$\phi_m = \tan^{-1} \left[ \frac{2 \zeta}{(\sqrt{4 \zeta^4 + 1} - 2\zeta^2)^{1/2}}\right]$$

Oftentimes, the phase margin is approximated by the following
relationship:

$$\phi_m \approx 100\zeta$$

The Greek letter zeta (ζ) is a quantity called the **damping ratio**,
and we discuss this quantity in more detail in the next chapter.

## Transform-Domain Delays

The ordinary Z-Transform does not account for a system which experiences
an arbitrary time delay, or a processing delay. The Z-Transform can,
however, be modified to account for an arbitrary delay. This new version
of the Z-transform is frequently called the **Modified Z-Transform**,
although in some literature (notably in Wikipedia), it is known as the
**Advanced Z-Transform**.

### Delayed Star Transform

To demonstrate the concept of an ideal delay, we will show how the star
transform responds to a time-shifted input with a specified delay of
time *T*. The function $$X^*(s, \Delta)$$ is the delayed star transform
with a delay parameter Δ. The delayed star transform is defined in terms
of the star transform as such:

$$X^*(s, \Delta)
        = \mathcal{L}^* \left\{ x(t - \Delta) \right\}
        = X(s)e^{-\Delta T s}$$

As we can see, in the star transform, a time-delayed signal is
multiplied by a decaying exponential value in the transform domain.

### Delayed Z-Transform

Since we know that the Star Transform is related to the Z Transform
through the following change of variables:

$$z = e^{-sT}$$

We can interpret the above result to show how the Z Transform responds
to a delay:

$$\mathcal{Z}(x[t - T]) = X(z)z^{-T}$$

This result is expected.

Now that we know how the Z transform responds to time shifts, it is
often useful to generalize this behavior into a form known as the
**Delayed Z-Transform**. The Delayed Z-Transform is a function of two
variables, *z* and Δ, and is defined as such:

$$X(z, \Delta)
        = \mathcal{Z} \left\{ x(t - \Delta) \right\}
        = \mathcal{Z} \left\{ X(s)e^{-\Delta T s} \right\}$$

And finally:

$$\mathcal{Z}(x[n], \Delta) = X(z, \Delta) = \sum_{n=-\infty}^\infty x[n - \Delta]z^{-n}$$

## Modified Z-Transform

The Delayed Z-Transform has some uses, but mathematicians and engineers
have decided that a more useful version of the transform was needed. The
new version of the Z-Transform, which is similar to the Delayed
Z-transform with a change of variables, is known as the **Modified
Z-Transform**. The Modified Z-Transform is defined in terms of the
delayed Z transform as follows:

$$X(z, m)
        = X(z, \Delta)\big|_{\Delta \to 1 - m}
        = \mathcal{Z} \left\{ X(s)e^{-\Delta T s} \right\}\big|_{\Delta \to 1 - m}$$

And it is defined explicitly:

$$X(z, m) = \mathcal{Z}(x[n], m) = \sum_{n = -\infty}^{\infty} x[n + m - 1]z^{-n}$$