Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
2 views

16 Breader

The document provides an overview of state space representation for dynamical systems, detailing both continuous-time and discrete-time systems. It explains the formulation of state variables, the evolution of these variables through differential and difference equations, and the concept of linearization around equilibrium points. Examples include the motion of a pendulum and an RLC circuit, illustrating how to model systems using state space techniques.

Uploaded by

asdfl lkjh
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

16 Breader

The document provides an overview of state space representation for dynamical systems, detailing both continuous-time and discrete-time systems. It explains the formulation of state variables, the evolution of these variables through differential and difference equations, and the concept of linearization around equilibrium points. Examples include the motion of a pendulum and an RLC circuit, illustrating how to model systems using state space techniques.

Uploaded by

asdfl lkjh
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 78

M U R AT A R C A K

EE16B NOTES
SPRING’17
2 murat arcak

Copyright © 2017 Murat Arcak


Licensed under a Creative Commons Attribution-NonCommercial-
ShareAlike 4.0 International License
Control Systems

State Space Representation of Dynamical Systems

State variables are a set of variables that fully represent the state of a
dynamical system at a given time, e.g., capacitor voltages and induc-
tor currents in a circuit, or positions and velocities in a mechanical
system. We denote by ~x (t) the vector of these state variables and
refer to it as the state vector.

Continuous-Time Systems

In a continuous-time system with n state variables, ~x (t) ∈ Rn evolves


according to a differential equation of the form

d
~x (t) = f (~x (t)) (1)
dt
where f (~x (t)) is an n-vector that dictates the derivatives of each state
variable according to the current value of the states. The form of f
depends on the system we are modeling as we will see in examples.
If the system has input variables we can manipulate (e.g. voltage
and current sources in a circuit, or force and torque delivered to a
mechanical system), we represent the system as

d
~x (t) = f (~x (t), ~u(t))
dt
where we refer to ~u(t) as the control input, since we can manipulate
this input to influence the behavior of the system. Most of our exam-
ples will contain a single control input, but we write ~u(t) as a vector
to allow for multiple control inputs.
Finally, we denote by w ~ (t) other inputs that are not under our con-
trol, e.g. wind force in a flight control system, and add it to our
model:
d
~x (t) = f (~x (t), ~u(t), w
~ (t)).
dt
4 murat arcak

~ (t) are often called disturbances.


The inputs contained in w
Example 1: The motion of the pendulum depicted on the right is
governed by the differential equation θ

`
d2 θ ( t ) dθ (t)
m` 2
= −k` − mg sin θ (t) (2)
dt dt
where the left hand side is mass×accelaration in the tangential direc-
mg sin θ
tion and the right hand side is total force acting in that direction.
To bring this second order differential equation to state space form mg

we define the state variables


dθ (t)
x1 ( t ) , θ ( t ) x2 ( t ) ,
dt
and note that they satisfy
dx1 (t)
= x2 ( t )
dt (3)
dx2 (t) k g
= − x2 (t) − sin x1 (t).
dt m `
The first equation here follows from the definition of x2 (t), and the
second equation follows from (2). In this state representation we
have two first order differential equations, one for each state variable,
instead of the second order differential equation (2) for one variable.
Here we did not consider disturbances or control inputs that could be
applied (say, to balance the pendulum in the upright position) so the
equations (3) have the form (1) with
" #
x2 ( t )
f (~x (t)) = .
− mk x2 (t) − g` sin x1 (t)
+ vR - + vL - + vC -
Example 2: Consider the RLC circuit depicted on the right where u
denotes the input voltage. R L C i

Since the capacitor and inductor satisfy the relations


dvc (t) + u -
C = i (t)
dt
di (t)
L = v L ( t ), (4)
dt
we select x1 = vC and x2 = i as the state variables, and eliminate
v L (t) from the right hand side of (4) using KVL and Ohm’s Law:
v L = −vC − v R + u = −vC − Ri + u.
Then the state model becomes
dx1 (t) 1
= x2 ( t )
dt C (5)
dx2 (t) 1
= (− x1 (t) − Rx2 (t) + u(t)) .
dt L
ee16b notes spring’17 5

Discrete-Time Systems

In a discrete-time system, ~x (t) evolves according to a difference equa-


tion rather than a differential equation:
~x (t + 1) = f (~x (t), ~u(t), w
~ (t)) t = 0, 1, 2, . . .
Here f (~x (t), ~u(t), w
~ (t)) is a vector that dictates the value of the state
vector at the next time instant based on the present values of the
states and inputs.
Example 3: Let s(t) denote the inventory of a manufacturer at the
start of the t-th business day. The inventory at the start of the next
day, s(t + 1), is the sum of s(t) and the goods g(t) manufactured,
minus the goods w(t) sold on day t. Assuming it takes a day to do
the manufacturing, the amount of goods g(t) manufactured is equal
to the raw material available the previous day, r (t − 1). The raw
material r (t) is equal to the order placed the previous day, u(t − 1),
assuming it takes a day for the order to arrive.
The state variables s(t), g(t), r (t), thus evolve according to the model
s ( t + 1) = s ( t ) + g ( t ) − w ( t )
g ( t + 1) = r ( t ) (6)
r ( t + 1) = u ( t ).
Note that the order u(t) is an input that the manufacturer can con-
trol, but the amount of goods sold, w(t), depends on the customers.
Example 4: Let p(t) be the number of EECS professors in a country
in year t, and let r (t) be the number of industry researchers with a
PhD degree. A fraction, γ, of the PhDs become professors themselves
and the rest become industry researchers. A fraction, δ, in each pro-
fession leaves the field every year due to retirement or other reasons.
Each professor graduates, on average, u(t) PhD students per year. We
treat this number as a control input because it can be manipulated
by the government using research funding. This means there will be
p(t)u(t) new PhDs in year t, and γp(t)u(t) new professors. The state
model is then
p(t + 1) = (1 − δ) p(t) + γp(t)u(t)
(7)
r ( t + 1) = (1 − δ )r ( t ) + (1 − γ ) p ( t ) u ( t ).

Linear Systems

~ ) ∈ Rn is linear in ~x ∈ Rn , ~u ∈ Rm , w
When f (~x, ~u, w ~ ∈ Rd , we can
rewrite it in the form
f (~x, ~u, w
~ ) = A~x + Bu~u + Bw w
~
6 murat arcak

where A is a n × n matrix, Bu is n × m, and Bw is n × d. The state


equations then take the form
d
~x (t) = A~x (t) + Bu~u(t) + Bw w
~ (t)
dt
~x (t + 1) = A~x (t) + Bu~u(t) + Bw w
~ (t)

for a continuous- and discrete-time system, respectively. When we


don’t need to differentiate between control and disturbance inputs,
we drop the subscripts u and w from B.
Note that the models in Examples 2 and 3 above are linear1 . In par- 1
Why are Examples 1 and 4 nonlinear?
ticular we can write (6) in the matrix form:
        
s ( t + 1) 1 1 0 s(t) 0 −1
 g ( t + 1)  = 0 0 1  g ( t )  + 0 u ( t ) +  0  w ( t ).
        
r ( t + 1) 0 0 0 r (t) 1 0
| {z } | {z } | {z } |{z} | {z }
~x (t + 1) A ~x (t) Bu Bw

Likewise, we rewrite (5) as:


dx1 (t)
" # " #" # " #
1
dt 0 C x1 ( t ) 0
dx2 (t) = 1 R + 1 u ( t ).
dt
−L −L x2 ( t ) L
| {z } | {z } | {z } |{z}
d A ~x (t) B
~x (t)
dt

Changing State Variables

It is important to note that the choice of state variables is not unique.


Given the state vector ~x ∈ Rn any transformation of the form

~z , T~x, (8)

where T is a n × n invertible matrix, defines new variables zi , i =


1, . . . , n, as a linear combination of the original variables x1 , . . . , xn .
To see how this change of variables affects the state equation

~x (t + 1) = A~x (t) + B~u(t),

note that
~z(t + 1) = T~x (t + 1) = TA~x (t) + TB~u(t)
and substitute ~x = T −1~z in the right hand side to obtain:

~z(t + 1) = TAT −1~z(t) + TB~u(t).

Thus the original A and B matrices are replaced with:

Anew = TAT −1 , Bnew = TB.


ee16b notes spring’17 7

The same change of variables brings the continuous-time system


d
~x (t) = A~x (t) + B~u(t)
dt
to the form
d
~z(t) = Anew~z(t) + Bnew~u(t)
dt
where Anew and Bnew are as defined above.
In the suquel we will use particular choices of T to bring Anew and
Bnew to special forms that will make it easy to analyze properties
such as stability and controllability.

Linearization

Linear models are advantageous because their solutions, stability


properties, and stabilizing controllers can be studied using linear
y
algebra. The methods applicable to nonlinear models are limited; y = f (x)
therefore it is common practice to approximate a nonlinear model
with a linear one that is valid around a desired operating point.
y = f (x∗ )
Recall that the Taylor approximation of a differentiable function f
+f 0 ( x ∗ )( x − x ∗)
around a point x ∗ is: x
∗ ∗ x∗
f ( x ) ≈ f ( x ) + ∇ f ( x )| x= x∗ ( x − x ),

as illustrated on the right for a scalar-valued function of a single vari-


able. When x and f ( x ) are n-vectors as in our state models, ∇ f ( x )
must be interpreted as the n × n matrix of partial derivatives:
 ∂ f ( x ,...,x ) ∂ f ( x ,...,x )
· · · ∂ f1 (x∂x1 ,...,xn )

1 1 n 1 1 n
∂x1 ∂x2 n
 ∂ f2 ( x1 ,...,xn ) ∂ f2 ( x1 ,...,xn ) ∂ f 2 ( x1 ,...,xn ) 

∂x 1 ∂x 2
· · · ∂x n

∇ f (x) =  .
 
.. .. ..

 . . . 

∂ f n ( x1 ,...,xn ) ∂ f n ( x1 ,...,xn ) ∂ f n ( x1 ,...,xn )
∂x 1 ∂x
2
· · · ∂xn

We linearize nonlinear state models by applying this approximation


around an equilibrium point. For the continuous-time system
d
~x (t) = f (~x (t)), (9)
dt
~x ∗ is called an equilbrium when f (~x ∗ ) = 0 because, if the initial
condition is ~x ∗ , then dt
d
~x (t) = 0 and ~x (t) remains at ~x ∗ . If we define
the deviation of ~x from ~x ∗ as:

x̃ (t) , ~x (t) − ~x ∗ (10)

then we see that


d
x̃ (t) = f (~x (t)) ≈ f (~x ∗ ) + ∇ f (~x )|~x=~x∗ x̃ (t).
dt
8 murat arcak

Substituting f (~x ∗ ) = 0 and defining

A , ∇ f (~x )|~x=~x∗ (11)

we obtain the linearization of (9) around the equilibrium ~x ∗ :


d
x̃ (t) ≈ A x̃ (t).
dt

In the discrete-time case


~x (t + 1) = f (~x (t)),
~x ∗ is an equilbrium point if f (~x ∗ ) = ~x ∗ . The vector x̃ (t) defined in
(10) satisfies:
x̃ (t + 1) = ~x (t + 1) −~x ∗ = f (~x (t)) −~x ∗ ≈ f (~x ∗ ) −~x ∗ + ∇ f (~x )|~x=~x∗ x̃ (t).
Substituting f (~x ∗ ) − ~x ∗ = 0 and defining A as in (11), we get

x̃ (t + 1) ≈ A x̃ (t).

Example 5: Recall the pendulum model derived in Example 1:


dx1 (t)
= x2 ( t )
dt (12)
dx2 (t) k g
= − x2 (t) − sin x1 (t)
dt m ` θ
where `
dθ (t)
x1 ( t ) , θ ( t ) and x2 ( t ) , .
dt
To find the equilibrium points note that
mg sin θ
" #
x2
f (~x ) = =0
− mk x2 − g` sin x1 mg

when x2 = 0 and sin x1 = 0. Thus the two distinct equilibrium points


are the downward position:
x1 = 0, x2 = 0, (13)
and the upright position:
x1 = π, x2 = 0. (14)
g
Since the entries of f (~x ) are f 1 (~x ) = x2 and f 2 (~x ) = − mk x2 − ` sin x1 ,
we have
" ∂ f ( x ,x ) ∂ f ( x ,x ) # " #
1 1 2 1 1 2
0 1
∇ f (~x ) = ∂ f2 (x1 ,x2 ) ∂ f2 (x1 ,x2 ) =
∂x1 ∂x2
.
∂x ∂x
− g` cos x1 −mk
1 2

By evaluating this matrix at (13) and (14), we obtain the linearization


around the respective equilibrium point:
" # " #
0 1 0 1
Adown = Aup = g −k . (15)
− g` −mk ` m
ee16b notes spring’17 9

Stability of Linear State Models

The Scalar Case

We first study a system with a single state variable x (t) that obeys

x (t + 1) = ax (t) + bu(t) (16)

where a and b are constants. If we start with the initial condition


x (0), then we get by recursion
x (1) = ax (0) + bu(0)
x (2) = ax (1) + bu(1) = a2 x (0) + abu(0) + bu(1)
x (3) = ax (2) + bu(2) = a3 x (0) + a2 bu(0) + abu(1) + bu(2)
..
.
x (t) = at x (0) + at−1 bu(0) + at−2 bu(1) + · · · + abu(t − 2) + bu(t − 1),
rewritten compactly as:
t −1
x ( t ) = a t x (0) + ∑ at−1−k bu(k) t = 1, 2, 3, . . . (17)
k =0

The first term at x (0) represents the effect of the initial condition and
the second term ∑tk− 1 t −1− k
=0 a bu(k) represents the effect of the input
sequence u(0), u(1), . . . , u(t − 1).
Definition. We say that a system is stable if its state x (t) remains
bounded for any initial condition and any bounded input sequence.
Conversely, we say it is unstable if we can find an initial condition and
a bounded input sequence such that | x (t)| → ∞ as t → ∞.

It follows from (17) that, if | a| > 1, then a nonzero initial condi-


tion x (0) 6= 0 is enough to drive | x (t)| unbounded. This is be-
cause | a|t grows unbounded and, with u(t) = 0 for all t, we get
| x (t)| = | at x (0)| = | a|t | x (0)| → ∞. Thus, (16) is unstable for | a| > 1.
Next, we show that (16) is stable when | a| < 1 is stable. In this
case at x (0) decays to zero, so we need only to show that the second
term in (17) remains bounded for any bounded input sequence. A
bounded input means we can find a constant M such that |u(t)| ≤ M
for all t. Thus,
t −1 t −1 t −1
∑ at−1−k bu(k) ≤ ∑ |a|t−1−k |b||u(k)| ≤ |b| M ∑ |a|t−1−k .
k =0 k =0 k =0

Defining the new index s = t − 1 − k we rewrite the last expression as


t −1
|b| M ∑ | a|s ,
s =0
10 murat arcak

and note that ∑ts− 1 s 1


=0 | a | is a geometric series that converges to 1−| a|
since | a| < 1. Therefore, each term in (17) is bounded and we con-
clude stability for | a| < 1.

Summary: The scalar system (16) is stable when | a| < 1, and


unstable when | a| > 1.

When a is a complex number, a perusal of the stability and instability


arguments above show that the same conclusions hold if we interpret
| a| as the modulus of a, that is:
q
| a| = Re{ a}2 + Im{ a}2 .

What happens when | a| = 1? If we disallow inputs (b = 0), this case


is referred to as “marginal stability" because | at x (0)| = | x (0)|, which
neither grows nor decays. If we allow inputs (b 6= 0), however, we can
find a bounded input to drive the second term in (17) unbounded.
For example, when a = 1, the constant input u(t) = 1 yields:
t −1 t −1
∑ at−1−k bu(k) = ∑ b = bt
k =0 k =0

which grows unbounded as t → ∞. Therefore, | a| = 1 is a precarious


case that must be avoided in designing systems.

The Vector Case

When ~x (t) is an n-dimensional vector governed by


~x (t + 1) = A~x (t) + Bu(t), (18)
recursive calculations lead to the solution
t −1
~x (t) = At~x (0) + ∑ At−1−k Bu(k) t = 1, 2, 3, . . . (19)
k =0

where the matrix power is defined as At = |A ·{z


· · A}.
t times
Since A is no longer a scalar, stability properties are not apparent
from (19). However, when A is diagonalizable we can employ the
change of variables ~z , T~x and select the matrix T such that
Anew = TAT −1
is diagonal. A and Anew have the same eigenvalues and, since Anew
is diagonal, the eigenvalues appear as its diagonal entries:
 
λ1

Anew =  .. 
.
 . 
λn
ee16b notes spring’17 11

The state model for the new variables is


 
λ1

~z(t + 1) =  .. 
 ~z(t) + Bnew u(t) (20)
 . 
λn
which nicely decouples into scalar equations:

z i ( t + 1 ) = λ i z i ( t ) + bi u ( t ) , i = 1, . . . , n (21)

where we denote by bi the i-th entry of Bnew . Then, the results for the
scalar case above imply stability when |λi | < 1 and instability when
|λi | > 1.
For the whole system to be stable each subsystem must be stable,
therefore we need |λi | < 1 for each i = 1, . . . , n. If there exists at least
one eigenvalue λi with |λi | > 1 then we conclude instability because
we can drive the corresponding state zi (t) unbounded.

Summary: The discrete-time system (18) is stable if |λi | < 1 for


each eigenvalue λ1 , . . . , λn of A, and unstable if |λi | > 1 for some
eigenvalue λi .

Although we assumed diagonalizability of A above, the same sta-


bility and instability conditions hold when A is not diagonalizable.
In that case a transformation exists that brings Anew to an upper-
diagonal form with eigenvalues on the diagonal2 . Thus, instead of 2
The details of this transformation are
(20) we have beyond the scope of this course.
 
λ1 ? · · · ?
 .. .. .. 
 . . . 
~z(t + 1) =   ~z(t) + Bnew u(t) (22)
 
..
. ?
 

λn
where the entries marked with ’?’ may be nonzero, but we don’t
need their explicit values for the argument that follows. Then it is not
difficult to see that zn obeys

z n ( t + 1 ) = λ n z n ( t ) + bn u ( t ) (23)

which does not depend on other states, so we conclude zn (t) remains


bounded for bounded inputs when |λn | < 1. The equation for zn−1
has the form

zn−1 (t + 1) = λn−1 zn−1 (t) + [? zn (t) + bn−1 u(t)] (24)

where we can treat the last two terms in brackets as a bounded input
since we have already shown that zn (t) is bounded. If |λn−1 | < 1 we
conclude zn−1 (t) is itself bounded and proceed to the equation:

zn−2 (t + 1) = λn−2 zn−2 (t) + [? zn−1 (t) + ? zn (t) + bn−2 u(t)]. (25)
12 murat arcak

Continuing this argument recursively we conclude stability when


|λi | < 1 for each eigenvalue λi .
To conclude instability when |λi | > 1 for some eigenvalue, note that
the ordering of the eigenvalues in (22) is arbitrary: we can put them
in any order we want by properly selecting T. Therefore, we can
assume without loss of generality that an eigenvalue with |λi | > 1
appears in the nth diagonal entry, that is |λn | > 1. Then, instability
follows from the scalar equation (23).

Stability of Continuous-Time Linear Systems

The solution of the scalar continuous-time system

d
x (t) = ax (t) + bu(t) (26)
dt
is given by
Z t
x (t) = e at x (0) + b e a(t−s) u(s)ds. (27)
0

It follows that this system is stable when a < 0 (in which case e at → 0
as t → ∞) and unstable when a > 0 (in which case e at → ∞).
Using a diagonalization argument as in the discrete-time case, we
conclude that the vector continuous-time system

d
~x (t) = A~x (t) + B~u(t) (28)
dt
is stable if Re{λi } < 0 for each eigenvalue λ1 , . . . , λn of A, and
unstable if Re{λi } > 0 for some eigenvalue λi .
The figures below highlight the regions of the complex plane where
the eigenvalues must lie for stability of a discrete-time (left) and
continuous-time (right) system.

Im(λ) Im(λ)

1 Re(λ)

Example 6: In Example 5 we derived continuous-time linearized


models for the downward and upright positions of the pendulum,
ee16b notes spring’17 13

and obtained:
" # " #
0 1 0 1
Adown = Aup = . (29)
− g` −k
m
g
`
−k
m

g
The eigenvalues of Adown are the roots of λ2 + mk λ + ` , which can
be shown to have strictly negative real parts when k > 0. Thus the
downward position is stable.
g
The eigenvalues of Aup are the roots of λ2 + mk λ − ` , which are given
by:
s s
 2  2
k 1 k g k 1 k g
λ1 = − − + 4 , λ2 = − + +4 .
2m 2 m ` 2m 2 m `

Since λ2 > 0, the upright position in unstable. Note that making


the length ` smaller increases the value of λ2 . This suggests that a
smaller length aggravates the instability of the upright position and
makes the stabilization task more difficult, as you would experience
when you try to balance a stick in your hand.

Predicting System Behavior from Eigenvalue Locations

We have seen that the solutions of a discrete-time system are com-


posed of λit terms where λi ’s are the eigenvalues of A. Thus, to pre-
dict the nature of the solutions (damped, underdamped, unbounded,
etc.), it is important to visualize the sequence λt , t = 1, 2, . . . for a
given λ. If we rewrite λ as λ = |λ|e jω where |λ| is the distance to the
origin in the complex plane, then we get

λt = |λ|t e jωt = |λ|t cos(ωt) + j |λ|t sin(ωt),

the real part of which is depicted in Figure 1 for various values of λ.


Note that the envelope |λ|t decays to zero when λ is inside the unit
disk (|λ| < 1) and grows unbounded when it is outside (|λ| > 1),
which is consistent with our stability criterion.
Likewise, for a continuous-time system each eigenvalue λi con-
tributes a function of the form eλi t to the solution. Decomposing λ
into its real and imaginary parts, λ = v + jω, we get

eλt = evt e jωt = evt cos(ωt) + j evt sin(ωt).

Figure 2 depicts the real part of eλt for various values of λ. Note that
the envelope evt decays when v = Re(λ) < 0 as in our stability
condition.
14 murat arcak

Figure 1: The real part of λt for various


3

2
values of λ in the complex plane. It
grows unbounded when |λ| > 1, decays
0.8

0.6

1
0.4

0.2

0
0
to zero when |λ| < 1, and has constant
-0.2

-0.4 -1
amplitude when λ is on the unit circle
-0.6

-0.8
0 5 10 15 20 25
-2
(|λ| = 1).
4 -3
0 5 10 15 20 25

3
Im(λ) 3.5

2 3

2.5
1

2
0

1.5
-1

1
-2

0.5
-3

0
0 5 10 15 20 25
-4
0 5 10 15 20 25

Re(λ)
2

1.5
1.5

1
0.5

0
0.5

-0.5

-1 0

-1.5

-0.5
0 5 10 15 20 25
-2
0 5 10 15 20 25

2
1

0.9

0.8

1.5 0.7

0.6

0.5

1 0.4

0.3

0.5
0.2

0.1

0
0 5 10 15 20 25

-0.5

-1

-1.5

-2
0 5 10 15 20 25

Im(λ) Figure 2: The real part of eλt for various


3

2
values of λ in the complex plane.
1.5

1
Note that eλt is oscillatory when λ has
1

0.8

0.6
0.8

0.6
1
1

0
an imaginary component. It grows
0.5

unbounded when Re{λ} > 0, decays to


0.4 0.4

0.2 0.2

0 0
0 -1

zero when Re{λ} < 0, and has constant


-0.2 -0.2

-0.4 -0.4
-0.5
-0.6 -0.6
-2

-0.8
-0.8

-1
0 1 2 3 4 5 6 7 8 9 10 -1
0 1 2 3 4 5 6 7 8 9 10
-1

-1.5
-3
0 1 2 3 4 5 6 7 8 9 10
amplitude when Re{λ} = 0.
0 1 2 3 4 5 6 7 8 9 10

1.5

1 2
1
1
0.8
0.8

0.6
0.6
1
0.4 0.5
0.4

0.2
0.2

0
0
0 0
-0.2
-0.2

-0.4
-0.4
-0.5
-1
-0.6
-0.6

-0.8 -0.8

-1 -1
-1
0 1 2 3 4 5 6 7 8 9 10 0 1 2 3 4 5 6 7 8 9 10 -2

-1.5
0 1 2 3 4 5 6 7 8 9 10
-3
0 1 2 3 4 5 6 7 8 9 10

2
2.8

1.8
2.6
1.6
2.4
1.4

2.2
1.2

2
1
1 1

0.9
0.9
1.8
0.8 0.8
0.8
0.7
1.6
0.6 0.7 0.6

0.5
0.6
0.4 1.4
0.4
0.5
0.3
0.2 1.2
0.4
0.2

0.1
0 1 2 3 4 5 6 7 8 9 10
0.3
0 1 2 3 4 5 6 7 8 9 10 0 1
0 1 2 3 4 5 6 7 8 9 10 0 1 2 3 4 5 6 7 8 9 10

Re(λ)
ee16b notes spring’17 15

Example 7: In Example 2 we modeled the RLC circuit depicted on


the right as

dx1 (t) 1
= x2 ( t )
dt C
dx2 (t) 1
= (− x1 (t) − Rx2 (t) + u(t))
dt L
where x1 = vC and x2 = i. Since this model is linear we can rewrite it
in the form (28), with " #
1
0 C + vR - + vL - + vC -
A= .
− L1 − RL
R L C i
Then the roots of
R 1
det(λI − A) = λ2 + λ+
L LC + u -
give the eigenvalues:
R 1
q
λ1,2 = −α ∓ α2 − ω02 where α, , ω0 , √ .
2L LC
For α > ω0 we have two real, negative eigenvalues which indicate a
damped response. For α < ω0 , we get the complex eigenvalues
q
λ1,2 = −α ∓ jω where ω , ω02 − α2 ,

indicating oscillations with frequency ω and decaying envelope e−αt .

Controllability

We have seen that the solution of the discrete-time state model

~x (t + 1) = A~x (t) + Bu(t), (30)

where ~x (t) is an n-dimensional vector, is given by

~x (t) = At~x (0) + At−1 Bu(0) + At−2 Bu(1) + · · · + ABu(t − 2) + Bu(t − 1)

or, equivalently,
 
u (0)
 u (1) 
i 
..
h
~x (t) − At~x (0) = At−1 B A t −2 B · · ·
 
AB B  . (31)
 . 
} 
 u ( t − 2) 
| {z
, Rt
u ( t − 1)

Can we find an input sequence u(0), u(1), . . . , u(t − 1) that brings the
state from ~x (0) to a desired value ~x (t) = ~xtarget ? The answer is yes
16 murat arcak

if ~xtarget − At~x (0) lies in the range space of Rt because, then we can
find appropriate values for u(0), u(1), . . . , u(t − 1), i.e. an appropriate
linear combination of the columns of Rt , so that the right hand side
of (31) is ~xtarget − At~x (0) and, thus, ~x (t) = ~xtarget .
Now, if we want to be able to reach any ~xtarget from any initial ~x (0)
– a property we henceforth refer to as controllability – then the range
of Rt must be the whole n-dimensional space, that is Rt must have n
linearly independent columns for some t.
Since increasing t amounts to adding more columns to Rt , it may ap-
pear that we may eventually have n independent columns. However,
this is not so: if we don’t have n independent columns in Rt at t = n, we
never will for t > n. This is a consequence of a result3 in linear algebra 3
This result is known as the Cayley-
which states that, if A is n × n, then An can be written as a linear Hamilton Theorem and its details are
beyond the scope of this course. You
combination of An−1 , . . . , A, I: can consult the Wikipedia article if you
are interested.
A n = α n −1 A n −1 + · · · + α 1 A + α 0 I for some α n −1 , . . . , α 1 , α 0 .

Multiplying both sides from the right by B we see that An B is itself


a linear combination of An−1 B, . . . , AB, B. This means that the new
columns in Rn+1 are merely linear combinations of the columns of
Rn , and the same argument extends to Rn+2 , Rn+3 , · · · .
Thus, for controllability, we need Rn to have n linearly independent
columns, which means rank = n:
h i
Controllability ⇔ rank An−1 B A n −2 B ··· AB B = n.

Example 8: The system


" # " #
1 1 1
~x (t + 1) = ~x (t) + u(t)
0 2 0
| {z } |{z}
A B
is uncontrollable because the matrix
" #
h i 1 1
AB B =
0 0

has rank = 1 rather than n = 2. The reason for uncontrollability


becomes clear if we write the equation for x2 (t) explicitly:

x2 (t + 1) = 2x2 (t).

The right hand side doesn’t depend on u(t) or x1 (t), which means
that x2 (t) evolves independently and can be influenced neither di-
rectly by input u(t), nor indirectly through the other state x1 (t).
ee16b notes spring’17 17

Example 9: Consider a vehicle moving in a lane with speed v(t).


We are able to change the acceleration, u(t), every T seconds and it
remains constant for the next T seconds. This suggests a discrete-
time model which we obtain from the relationship
d
v(t) = u(t)
dt
by integrating both sides from t to t + T and keeping in mind that
u(t) is constant in this interval, that is u(t + τ ) = u(t) for τ ∈ [0, T ):
Z T
v(t + T ) − v(t) = u(t + τ )dτ = Tu(t). (32)
0

Next, we let p(t) denote the position and note that


d
p ( t ) = v ( t ).
dt
Integrating from t to t + T and substituting v(t + τ ) = v(t) + τu(t)
we get
Z T
1
p(t + T ) − p(t) = (v(t) + τu(t))dτ = Tv(t) + T 2 u(t). (33)
0 2

Finally we combine (32) and (33) into the state model:


" # " #" # " #
1 2
p(t + T ) 1 T p(t) T
= + 2 u(t)
v(t + T ) 0 1 v(t) T
| {z } | {z }
A B
which is of the form (30) if we take the unit time to be T seconds.
The controllability condition above holds: the rank of
" #
3 2 1 2
h i
2 T 2 T
AB B =
T T

is indeed n = 2. This confirms that we can move the vehicle to an ar-


bitrary target location ptarget and stop there (vtarget = 0) by applying
an appropriate input sequence obtained from (31).

Controllability in Continuous-Time

The controllability condition for the continuous-time system


d
~x (t) = A~x (t) + Bu(t)
dt
is exactly the same: rank( Rn ) = n where Rn is as defined above. We
omit the derivation for this case but illustrate the result with a circuit
example.
18 murat arcak

Example 10: For the circuit depicted on the right we treat the current
source as the control u(t), and the inductor currents i1 (t) and i2 (t) as
the state variables. i1 i2 iR
u
Since the voltage across each capacitor is the same as the voltage
L1 L2 R
across the resistor, we have

di1 (t)
L1 = Ri R (t)
dt (34)
di2 (t)
L2 = Ri R (t).
dt
Substituting i R = u − i1 − i2 from KCL and dividing the equations by
L1 and L2 respectively, we get
di1 (t)
" # " #" # " #
dt
− LR1 − LR1 i1 (t) R
L1
di2 (t) = + R u ( t ).
dt
− LR2 − LR2 i2 (t) L2
| {z } | {z }
A B
Note that
  
− LR1R
+ R 
R R

AB =   L1 L2  
=− + B
− LR2 LR1 + R
L2
L1 L2

which means that AB and B are linearly dependent. Thus


h i
rank AB B = 1,

and the model is not controllable.


To see the physical obstacle to controllability note that the two induc-
tors in parallel share the same voltage:

di1 (t) di (t)


L1 = L2 2 .
dt dt
Thus,
d
( L i (t) − L2 i2 (t)) = 0
dt 1 1
which means that the difference between the two inductor fluxes,
L1 i1 − L2 i2 , remains constant no matter what u we apply.
Because of this constraint we can’t control i1 and i2 independently.
We can, however, control the total current i L = i1 + i2 which obeys,
from (34),

di L (t)
 
1 1 R
= + Ri R (t) = (−i L (t) + u(t))
dt L1 L2 L
  −1 iL iR
where L , L1 + L12 . Note that this is the governing equation for u
1
the circuit on the right where the two inductors are lumped into one. L R
ee16b notes spring’17 19

State Feedback Control

Suppose we are given a single-input control system

~x (t + 1) = A~x (t) + Bu(t), u(t) ∈ R, (35)

and we wish to bring the solution ~x (t) to the equilibrium ~x = 0 from


any initial condition ~x (0).
To achieve this goal we will study a “control policy" of the form

u ( t ) = k 1 x1 ( t ) + k 2 x2 ( t ) + · · · + k n x n ( t ) (36)

where k1 , k2 , . . . , k n are to be determined. Rewriting (36) as

u(t) = K~x (t) (37)

with row vector K = [k1 k2 · · · k n ], and substituting in (35), we get

~x (t + 1) = ( A + BK )~x (t). (38)

Thus, if we can choose K such that all eigenvalues of A + BK satisfy


the stability condition |λi ( A + BK )| < 1, then ~x (t) → 0 from any ~x (0).
We will see that if the system (35) is controllable, then we can arbi-
trarily assign the eigenvalues of A + BK with the choice of K. Thus,
in addition to bringing the eigenvalues inside the unit disk for stabil-
ity, we can place them in favorable locations to shape the transients,
e.g., to achieve a well damped convergence.

u(t)
~x (t + 1) = A~x (t) + Bu(t)

x1 ( t )
k1
+ .. ..
. .
+ xn (t)
kn

We refer to (38) as the "closed-loop" system since the control policy


(36) generates a feedback loop as depicted in the block diagram. The
state variables are measured at every time step t and the input u(t) is
synthesized as a linear combination of these measurements.
20 murat arcak

Comparison to Open Loop Control

Recall that controllability allowed us to calculate an input sequence


u(0), u(1), u(2), . . . that drives the state from ~x (0) to any ~xtarget . Thus,
an alternative to the feedback control (36) is to select ~xtarget = 0, cal-
culate an input sequence based on ~x (0), and to apply this sequence in
an “open-loop" fashion without using further state measurements as
depicted below.

u (0), u (1), u (2), . . .


~x (t + 1) = A~x (t) + Bu(t)

The trouble with this open-loop approach is that it is sensitive to


uncertainties in A and B, and does not make provisions against dis-
turbances that may act on the system.
By contrast, feedback offers a degree of robustness: if our design of
K brings the eigenvalues of A + BK to well within the unit disk, then
small perturbations in A and B would not move these eigenvalues
outside the disk. Thus, despite the uncertainty, solutions converge
to ~x = 0 in the absence of disturbances and remain bounded in the
presence of bounded disturbances.

Eigenvalue Assignment by State Feedback: Examples

Example 11: Consider the second order system


" # " #
0 1 0
~x (t + 1) = ~x (t) + u(t)
a1 a2 1
| {z } |{z}
A B
and note that the eigenvalues of A are the roots of the polynomial

det(λI − A) = λ2 − a2 λ − a1 .

If we substitute the control

u(t) = K~x (t) = k1 x1 (t) + k2 x2 (t)

the closed-loop system becomes


" #
0 1
~x (t + 1) = ~x (t)
a1 + k 1 a2 + k 2
| {z }
A + BK
ee16b notes spring’17 21

and, since A + BK has the same structure as A with a1 , a2 replaced by


a1 + k1 , a2 + k2 , the eigenvalues of A + BK are the roots of

λ2 − ( a2 + k 2 ) λ − ( a1 + k 1 ).

Now if we want to assign the eigenvalues of A + BK to desired values


λ1 and λ2 , we must match the polynomial above to

(λ − λ1 )(λ − λ2 ) = λ2 − (λ1 + λ2 )λ + λ1 λ2 ,

that is,
a2 + k 2 = λ1 + λ2 and a1 + k 1 = − λ1 λ2 .

This is indeed accomplished with the choice k1 = − a1 − λ1 λ2 and


k2 = − a2 + λ1 + λ2 , which means that we can assign the closed-loop
eigenvalues as we wish.

Example 12: Let’s apply the eigenvalue assignment procedure above


to " # " #
1 1 1
~x (t + 1) = ~x (t) + u ( t ).
0 2 0
| {z } |{z}
A B
Now we have
" # " # " #
1 1 1 h i 1 + k1 1 + k2
A + BK = + k1 k2 =
0 2 0 0 2

and, because this matrix is upper diagonal, its eigenvalues are the
diagonal entries:
λ1 = 1 + k1 and λ2 = 2.

Note that we can move λ1 with the choice of k1 , but we have no con-
trol over λ2 . In fact, since |λ2 | > 1, the closed-loop system remains
unstable no matter what control we apply.
This is a consequence of the uncontrollability of this system, which
was shown in Example 8. The second state equation

x2 (t + 1) = 2x2 (t)

can’t be influenced by u(t), and x2 (t) = 2t x2 (0) grows exponentially.

Continuous-Time State Feedback

The idea of state feedback is identical for a continuous-time system,

d
~x (t) = A~x (t) + Bu(t), u(t) ∈ R.
dt
22 murat arcak

To bring ~x (t) to the equilibrium ~x = 0 we apply

u(t) = K~x (t)

and obtain the closed-loop system

d
~x (t) = ( A + BK )~x (t).
dt
The only difference from discrete-time is the stability criterion: we
must choose K such that Re{λi ( A + BK )} < 0 for each eigenvalue λi .
Example 13: Consider the inverted pendulum system depicted be-
low.

m
θ `

u
M

The equations of motion are


!
1 u
ÿ = M
+ θ̇ 2 ` sin θ − g sin θ cos θ
m + sin2 θ m
!
1 u M+m
θ̈ = − cos θ − θ̇ 2 ` cos θ sin θ + g sin θ
`( M
m + sin2 θ ) m m

and linearization about the upright position θ = 0, θ̇ = 0 gives

m 1
ÿ = − gθ + u
M M (39)
M+m 1
θ̈ = gθ − u.
M` M`
We write (39) in state space form as
      
θ (t) 0 1 0 θ (t) 0
d 
 θ̇ (t)  =  MM+`m g 0 0  θ̇ (t)  + − M1 `  u(t),
     
dt
ẏ(t) − m g 0 0 ẏ(t) 1
| M {z } M
| {z }
A B
where we have omitted y(t) from the state vector because we are
interested in stabilizing the point θ = 0, θ̇ = 0, ẏ = 0, and we are not
concerned about the final value of the position y(t). If it is of interest
to bring y(t) to a specific position the state equations above can be
augmented with y(t), leading to a fourth order model.
ee16b notes spring’17 23

We now design a state feedback controller,

u(t) = k1 θ (t) + k2 θ̇ (t) + k3 ẏ(t).

Substituting the values M = 1, m = 0.1, l = 1, and g = 10, we get


     
0 1 0 0 h i 0 1 0
 11 0 0 + −1 k1 k2 k3 =  11 − k1 −k2 −k3  .
     
−1 0 0 1 −1 + k 1 k 2 k3
| {z } | {z }
A B
The characteristic polynomial of this matrix is

λ3 + (k2 − k3 )λ2 + (k1 − 11)λ + 10k3 = 0

and, as in Example 11, we can choose k1 , k2 , k3 , to match the coeffi-


cients of this polynomial to those of

(λ − λ1 )(λ − λ2 )(λ − λ3 )
where λ1 , λ2 , λ3 are desired closed-loop eigenvalues.

Eigenvalue Assignment by State Feedback

Our goal in this section is to show that controllability allows us to


arbitrarily assign the eigenvalues of A + BK with the choice of K. We
will do this by generalizing the special structure in Example 11:
" # " #
0 1 0
~x (t + 1) = ~x (t) + u ( t ),
a1 a2 1 (40)
| {z } |{z}
A B
where the eigenvalues of A + BK are the roots of

λ2 − ( a2 + k 2 ) λ − ( a1 + k 1 )

and can be assigned to desired values λ1 and λ2 by matching the


polynomial above to

(λ − λ1 )(λ − λ2 ) = λ2 − (λ1 + λ2 )λ + λ1 λ2 .

Controller canonical form

We now generalize the special structure of A and B in (40) to n > 2:


   
0 1 0 ··· 0 0
. .. ..  .
 .. 0 1 . . .
.
 

.
A=. .. .. B =  ..  . (41)
  
. . . 0

.
0 ··· ···
   
0 1 0
a 1 a 2 · · · a n −1 a n 1
24 murat arcak

The first benefit of this structure is the simple form of the polynomial

det(λI − A) = λn − an λn−1 − an−1 λn−2 − · · · − a2 λ − a1

whose roots constitute the eigenvalues of A. The second benefit is


that A + BK preserves the structure of A, except that the entry ai is
replaced by ai + k i , i = 1, . . . , n. Therefore,

det(λI − ( A + BK )) = λn − ( an + k n )λn−1 · · · − ( a2 + k2 )λ − ( a1 + k1 )

and assigning the closed-loop eigenvalues to desired values λ1 , . . . , λn


amounts to matching the coefficients of this polynomial to those of

(λ − λ1 )(λ − λ2 ) · · · (λ − λn ). (42)

Thus eigenvalue assignment is straightforward when A and B have


the special form above, known as the controller canonical form.
Example 14: Suppose we want all eigenvalues of A + BK to be 0 for
   
0 1 0 0
A = 0 0 1 B = 0 .
   
1 2 3 1

This means that we must match the polynomial

det(λI − ( A + BK )) = λ3 − (3 + k3 )λ2 − (2 + k2 )λ − (1 + k1 )

to λ3 which has three roots at 0. This is accomplished with the choice


k1 = −1, k2 = −2, k3 = −3. 

Controllability enables eigenvalue assignment

It turns out that we can bring any controllable, single-input system

~x (t + 1) = Ã~x (t) + B̃u(t) (43)

to the controller canonical form with a change of variables ~z = T~x;


that is, there exists T such that

T ÃT −1 = A and T B̃ = B (44)

where A and B are as in (41).


This means that we can design a state feedback u = K~z to assign the
eigenvalues of A + BK using the procedure above for the controller
canonical form. Since ~z = T~x, u = K~z is identical to u = K̃~x where

K̃ = KT (45)
ee16b notes spring’17 25

and, since T ( à + B̃K̃ ) T −1 = A + BK, the eigenvalues of à + B̃K̃ are


the same as those of A + BK.

Conclusion: If the system (43) is controllable, then we can


arbitrarily assign the eigenvalues of à + B̃K̃ with an appropriate
choice of K̃.

How can we find a matrix T that satisfies (44)? Recall the matrix we
use for checking controllability:
h i
Rn = An−1 B · · · AB B . (46)

If we substitue (44), we see that


h i
Rn = ( T Ãn−1 T −1 )( T B̃) · · · ( T ÃT −1 )( T B̃) ( T B̃)
h i
= T Ãn−1 B̃ · · · Ã B̃ B̃ (47)
| {z }
= R̃n

which suggests the choice T = Rn R̃− 1


n .

R̃n is full rank, thus invertible, because (43) is controllable. Likewise,


Rn has the lower diagonal form
 
1 0 ··· 0
 .. .
? 1 . .. 
Rn =  .
 
..

.
. . 0

? ··· ? 1

that has rank n regardless of the values of the entries marked as ’?’.
Then T = Rn R̃− 1
n is itself invertible, thus a viable choice for (44).

Summary

We used the controller canonical form to prove that controllability


allows us to arbitrarily assign the eigenvalues of A + BK. In prac-
tice, however, it is not necessary to bring the system to the controller
canonical form to assign its eigenvalues. We can simply calculate the
characteristic polynomial of A + BK and choose K to match its co-
efficients to those of the desired closed-loop polynomial (42). That’s
what we did in Example 13 for the inverted pendulum model, which
was not in controller canonical form.

Case Study: Cooperative Adaptive Cruise Control (CACC)

Consider a vehicle following another as depicted below.


26 murat arcak

pf
pl

We denote by pl the position of the leader and by p f the position of


the follower, and write the continuous-time models
d
p (t) = vl (t)
dt l (48)
d
v (t) = ul (t)
dt l
and
d
p (t) = v f (t)
dt f (49)
d
v ( t ) = u f ( t ).
dt f
To maintain a constant distance δ between pl and p f , we define

x1 , p l − p f − δ x2 , v l − v f u , ul − u f , (50)

and obtain from (48) and (49) the following model that describes the
relative motion of the two vehicles:
d
x ( t ) = x2 ( t )
dt 1 (51)
d
x2 ( t ) = u ( t ).
dt
Then the task is to stabilize the equilibrium x1 = 0, x2 = 0 which
means pl − p f = δ and vl = v f . This is accomplished with

u ( t ) = k 1 x1 ( t ) + k 2 x2 ( t )

where k1 and k2 are selected such that the eigenvalues of


" #
0 1
A + BK =
k1 k2

have negative real parts.


Recall from (50) that u = ul − u f . Thus, if the lead vehicle broadcasts
its acceleration ul (t) to the follower via vehicle-to-vehicle wireless
communication4 , then the follower can implement the controller 4
hence the term cooperative adaptive
cruise control
u f (t) = ul (t) − u(t)
= u l ( t ) − k 1 x1 ( t ) − k 2 x2 ( t ) (52)
= ul (t) − k1 ( pl (t) − p f (t) − δ) − k2 (vl (t) − v f (t))
ee16b notes spring’17 27

using range sensors to obtain pl (t) − p f (t) and vl (t) − v f (t). In this
implementation the lead vehicle chooses its own input ul (t) without
regard to the follower, and the follower applies the controller (52) to
automatically follow the leader with constant relative distance δ.

Outputs and Observability

In applications we may not have measurements of all state variables,


but only an “output” vector

~y(t) = C~x (t).

If we have n states and p outputs, then C is a p × n matrix. For exam-


ple, if we measure only the ith state variable, y(t) = xi (t), then C has
a single row that consists of the ith unit vector.
Thus we augment our state model as

~x (t + 1) = A~x (t) + B~u(t)


(53)
~y(t) = C~x (t).
Then an important question is, if we only monitor the output ~y(t) can we
infer the full state ~x (t) with the help of this model? If the answer is yes,
we say that the system is observable.
Observability is equivalent to the ability to determine the initial state
~x (0) from a set of measurements ~y(0), ~y(1), . . . , ~y(t). This is because,
if we can determine ~x (0), then we can use the explicit solution of the
state equation studied earlier to find ~x (t).
To see how we may determine ~x (0) from ~y(0), ~y(1), . . . , ~y(t), assume
for now u(t) = 0 for all t and note that

~y(0) = C~x (0)


~y(1) = C~x (1) = CA~x (0)
.. (54)
.
~y(t) = C~x (t) = CAt~x (0)
or, equivalently,    
~y(0) C
~y(1)  CA 
   
 .  =  .  ~x (0). (55)
 .   . 
 .   . 
~y(t) CAt
| {z }
, Ot
To uniquely determine ~x (0), which has n entries, we need the matrix
Ot to have n linearly independent rows so that its null space is {0}.
28 murat arcak

It follows from an argument similar to the one we made for controlla-


bility that, if Ot doesn’t have n independent rows at t = n − 1, then it
never will5 for t ≥ n. 5
Try to prove this claim by adapting
our argument for the columns of Rt in
Thus, for observability, we need On−1 to have n linearly independent controllability to the rows of Ot .
rows, that is rank = n:

 
C
 CA 
 
Observability ⇔  ..  = n.
rank  
 . 
CAn−1

Although we assumed u(t) = 0 for all t above, adding inputs does


not change this observability condition. The only change in this case
is that the right hand side of (55) must be augmented with another
term that depends on the history of the input ~u(0), · · · , ~u(t − 1).
But this term is known, since we know the control inputs we have
applied, and can be subtracted from both sides of the equation. The
rest of the arguments above are therefore unchanged.

Example 15: Consider the second order system


" #
cos θ − sin θ x2
~x (t + 1) = ~x (t) (56)
sin θ cos θ
| {z } ~x (0)
A
~x (1) θ
where the matrix A rotates the state vector by an angle of θ at each
time instant, as depicted on the right. If the output is θ x1

h i
y(t) = x1 (t) = 1 0 ~x (t) (57) ~x (2)
| {z }
C

we get
" # " #
C 1 0
=
CA cos θ − sin θ

which has rank = n = 2 when sin θ 6= 0, and rank = 1 if sin θ = 0.


Thus, we lose observability for θ = nπ, n = 1, 2.
To see why observability is lost, suppose θ = π and y(t) = x1 (t) = 0
for each t. Then we can infer that ~x (0) points in the vertical direction,
and ~x (t) oscillates back and forth between the positive and negative
vertical axes. However, we have no information about the magnitude
of this oscillation and, thus, can’t determine ~x (0).
ee16b notes spring’17 29

Observers

An observer is an algorithm that estimates the full state ~x (t) from


measurements of ~y(t). Observers complement state feedback con-
trollers by providing estimates for states that are not available for
measurement.
One common observer algorithm is to start with an initial guess x̂ (0)
and to update it at each time according to the equation

x̂ (t + 1) = A x̂ (t) + L(C x̂ (t) − ~y(t)) + B~u(t) (58)

where L is a n × p matrix to be designed. Note that this update


rule incorporates the model of the physical system and augments
it with the correction term L(C x̂ (t) − ~y(t)). If the state estimate x̂ (t)
is consistent with the output measurement y(t) at that time, that is
C x̂ (t) = y(t), then the correction term is zero and the update rule
(58) simply mimics the physical model

~x (t + 1) = A~x (t) + B~u(t). (59)

The block diagram below illustrates how the observer algorithm


interacts with the physical system depicted on the left.

Physical System Observer Algorithm


~u(t) ~x (t + 1) = A~x (t) + B~u(t) ~y(t) x̂ (t + 1) = A x̂ (t) + B~u(t) x̂ (t)
~y(t) = C~x (t) + L(C x̂ (t) − ~y(t))

How should we design L to guarantee the convergence of x̂ (t) to the


correct state x (t)? To answer this question we define the estimation
error
~e(t) , x̂ (t) − ~x (t)
and note from (58) and (59) that

~e(t + 1) = A( x̂ (t) − ~x (t)) + L(C x̂ (t) − C~x (t))


(60)
= ( A + LC )~e(t).

Thus, if we design L such that all eigenvalues of A + LC are within


the unit disk then we guarantee e(t) = x̂ (t) − ~x (t) → 0; that is, the
estimate x̂ (t) approaches the state ~x (t) asymptotically.
It turns out that if the system is observable then we can assign the
eigenvalues of A + LC with an appropriate choice of L. We prove
30 murat arcak

this by analogy to controllability. First note that taking the transpose


of a matrix does not change its eigenvalues; therefore assigning the
eigenvalues of A + LC is equivalent to assigning the eigenvalues of

AT + C T LT . (61)

Now if we define A0 = A T , B0 = C T , K0 = L T , (61) takes the form


A0 + B0 K0 and we know that we can assign its eigenvalues by choice
of K0 if the pair ( A0 , B0 ) is controllable.
The next step, which we leave as an exercise, is to show that the
columns of the controllability matrix for ( A0 , B0 ), when transposed,
match the rows of the observability matrix for ( A, C ). Therefore they
have identical ranks and observability of ( A, C ) implies controlla-
bility of ( A0 , B0 ). Then we can assign the eigenvalues of A0 + B0 K0
with the design of K0 , and L = K0T assigns the same eigenvalues to
A + LC.

Example 16: Consider again the system


" #
cos θ − sin θ
~x (t + 1) = ~x (t)
sin θ cos θ
| {z }
A (62)
h i
y(t) = 1 0 ~x (t).
| {z }
C
If we take θ = π/2, for which the system is observable, then
" # " # " #
0 −1 l1 h i l1 −1
A + LC = + 1 0 =
1 0 l2 l2 + 1 0

whose eigenvalues are the roots of


" #
λ − l1 1
det = λ 2 − l1 λ + ( l2 + 1 ) .
− l2 − 1 λ

Note that, when l1 = l2 = 0, the eigenvalues are at ± j which are on


the unit circle. To move these eigenvalues to desired values λ1 , λ2
inside the unit disk we must match the coefficients of the polynomial
above to those of

(λ − λ1 )(λ − λ2 ) = λ2 − (λ1 + λ2 )λ + λ1 λ2 .

This means l1 = λ1 + λ2 and l2 = λ1 λ2 − 1. For example, if we choose


λ1,2 = ±0.9j which are inside the unit disk, we get l1 = 0, l2 = −0.19.
Now repeat this example for θ = π, in which case
" # " # " #
−1 0 l1 h i l1 − 1 0
A + LC = + 1 0 =
0 −1 l2 l2 −1
ee16b notes spring’17 31

and the eigenvalues are the roots of


" #
λ + 1 − l1 0
det = (λ + 1 − l1 )(λ + 1).
− l2 λ+1

Note that an eigenvalue at λ = −1 persists regardless of the choice of


l1 , l2 , which is a result of unobservability in the case where θ = π.

Example 17: Navigation is the task of identifying a vehicle’s position,


attitude, velocity, etc. relative to an inertial frame by integrating
multiple measurements which may be inaccurate individually. To
relate this task to observers consider the model of a vehicle moving in
a lane from Example 9,
" # " #" # " #
1 2
p ( t + 1) 1 T p(t) T
= + 2 u ( t ),
v ( t + 1) 0 1 v(t) T
| {z } | {z }
A B

where p(t) is position, v(t) is velocity, and u(t) is acceleration.


Without further measurements, our observer would be a simple copy
of the model above:
" # " #
p̂(t + 1) p̂(t)
=A + Bu(t).
v̂(t + 1) v̂(t)

This primitive strategy is known as dead reckoning and leads to major


errors over long distances because observer errors accumulate over
time and are not dissipated due to the eigenvalues of A at 1.
Modern navigation systems use satellite-based measurements of posi-
tion. However, since these measurements are noisy and intermittent,
it is reasonable to combine them with the dead reckoning method
above within the observer
" # " #
p̂(t + 1) p̂(t)
=A + L( p̂(t) − p(t)) + Bu(t)
v̂(t + 1) v̂(t)

where p(t) is treated as the output; that is

C = [1 0].

The task is then to design L such that A + LC has eigenvalues inside


the unit disk, which is possible since the pair (C, A) is observable
(show this).
With this architecture we make use of satellite measurements but do
not rely exclusively on them; we also exploit the system model which
can make accurate predictions in the short term.
32 murat arcak

A more elaborate form of the observer (58), where the matrix L is


also updated at each time, is known as the Kalman Filter and is
the industry standard in navigation. The Kalman Filter takes into
account the statistical properties of the noise that corrupts measure-
ments and minimizes the mean square error between x (t) and x̂ (t).

Figure 3: Rudolf Kalman (1930-2016)


introduced the Kalman Filter as well
as many of the state space concepts
we studied, such as controllability and
observability. He was awarded the
National Medal of Science in 2009.
Singular Value Decomposition (SVD)

SVD separates a rank-r matrix A ∈ Rm×n into a sum of r rank-1


matrices of the form ~u~v T (column times row). Specifically, we can
find:
1) orthonormal vectors ~u1 , . . . , ~ur ∈ Rm ,
2) orthonormal vectors ~v1 , . . . , ~vr ∈ Rn ,
3) real, positive numbers σ1 , . . . , σr such that

A = σ1~u1~v1T + σ2~u2~v2T + · · · + σr~ur~vrT . (63)

The numbers σ1 , . . . , σr are called singular values and, by convention,


we order them from the largest to smallest:

σ1 ≥ σ2 ≥ · · · ≥ σr > 0.

In its original form A has mn entries to be stored. In the SVD form


each of the r terms is the product of a column of m entries with a row
of n entries; therefore we need r (m + n) numbers to store. This is an
advantage when r is small relative to m and n, that is r (m + n)  mn.
In a typical application the exact rank r may not be particularly
small, but we may find that the first few singular values, say σ1 , . . . , σr̂ ,
are much bigger than the rest, σr̂+1 , . . . , σr . Then it is reasonable to
discard the small singular values and approximate A as

A ≈ σ1~u1~v1T + σ2~u2~v2T + · · · + σr̂~ur̂~vr̂T (64)

which has rank = r̂, thus r̂ (m + n)  mn numbers to store.


Example 1 (Netflix): Suppose we have a m × n matrix that contains
the ratings of m viewers for n movies. A truncated SVD as suggested
above not only saves memory; it also gives insight into the pref-
erences of each viewer. For example we can interpret each rank-1
matrix σi~ui~viT to be due to a particular attribute, e.g., comedy, action,
sci-fi, or romance content. Then σi determines how strongly the rat-
ings depend on the ith attribute, the entries of ~viT score each movie
34 murat arcak

with respect to this attribute, and the entries of ~ui evaluate how much
each viewer cares about this particular attribute. Then truncating
the SVD as in (64) amounts to identifying a few key attributes that
underlie the ratings. This is useful, for example, in making movie
recommendations as you will see in a homework problem.

Finding a SVD

To find a SVD of the form (63) we use either the n × n matrix A T A


or the m × m matrix AA T . We will see later that these matrices have
only real eigenvalues, r of which are positive and the remaining zero,
and a complete set of orthonormal eigenvectors. For now we take this
as a fact and propose the following procedures to find a SVD for A:

SVD procedure using A T A

1. Find the eigenvalues λi of A T A and order them from the largest to


smallest, so that λ1 ≥ · · · ≥ λr > 0 and λr+1 = · · · = λn = 0.
2. Find orthonormal eigenvectors ~vi , so that

A T A ~vi = λi~vi i = 1, . . . , r. (65)


3. Let σi = λi and obtain ~ui from

A~vi = σi~ui i = 1, . . . , r. (66)

Justification: To see that ~ui , i = 1, . . . , r, obtained from (66) are or-


thonormal, multiply (66) from the left by ( A~v j ) T = σj~u Tj :

( A~v j )T A~vi = σj σi~u Tj~ui . (67)

The left hand side is ~v Tj A T A~vi = ~v Tj λi~vi = σi2~v Tj~vi , therefore

σi2~v Tj~vi = σj σi~u Tj~ui . (68)

The vectors ~vi , i = 1, . . . , r, are orthonormal by construction, which


means ~v Tj~vi = 1 if i = j, and 0 if i 6= j. Thus, (68) becomes
(
σi2 if i = j
σj σi~u Tj~ui = (69)
0 if i 6= j

and σj σi cancels with σi2 when i = j, proving orthonormality of ~ui ,


i = 1, . . . , r.
ee16b notes spring’17 35

To see why σi , ~ui , ~vi resulting from the procedure above satisfy (63),
rewrite (66) in matrix form as:
 
σ
h i h i 1
A ~v1 · · ·~vr = ~u1 · · · ~ur  .. 
.
 . 
| {z }
σr
, V1

Next, multiply both sides from the right by V1T :


  
σ1 ~v1T
h i
..  . 
AV1 V1T = ~u1 · · · ~ur 
 .  . 
 .  (70)
σr ~vrT
| {z }
V1T

and note that the right hand side is indeed the decomposition in
(63). We conclude by showing
h i hand side is equal to A.
that the left
To this end define V2 = ~vr+1 · · · ~vn whose columns are the
remaining
h orthonormal
i eigenvectors for λr+1 = · · · = λn = 0. Then
V = V1 V2 is an orthonormal matrix and, thus,
" #
h i VT
VV T = V1 V2 1 = V1 V1T + V2 V2T = I.
V2T

Multiplying both sides from the left by A, we get

AV1 V1T + AV2 V2T = A. (71)

Since the columns of V2 are eigenvectors of A T A for zero eigenvalues


we have A T AV2 = 0, and multiplying this from the left by V2T we
get V2T A T AV2 = ( AV2 ) T ( AV2 ) = 0. This implies AV2 = 0 and it
follows from (71) that AV1 V1T = A. Thus, the left hand side of (70)
is A, which proves that σi , ~ui , ~vi proposed by the procedure above
satisfy (63). 

An alternative approach is to use the m × m matrix AA T which is


preferable to using the n × n matrix A T A when m < n. Below we
summarize the procedure and leave its justification as an exercise.

SVD procedure using AA T

1. Find the eigenvalues λi of AA T and order them from the largest to


smallest, so that λ1 ≥ · · · ≥ λr > 0 and λr+1 = · · · = λm = 0.
2. Find orthonormal eigenvectors ~ui , so that

AA T ~ui = λi~ui i = 1, . . . , r. (72)


36 murat arcak


3. Let σi = λi and obtain ~vi from

A T~ui = σi~vi i = 1, . . . , r. (73)

Example 2: Let’s follow this procedure to find a SVD for


" #
4 4
A= .
−3 3

We calculate
" #" # " #
4 4 4 −3 32 0
AA T = =
−3 3 4 3 0 18

which happens to be diagonal, so the eigenvalues are λ1 = 32, λ2 =


18, and we can select the orthonormal eigenvectors:
" # " #
1 0
~u1 = ~u2 = . (74)
0 1
√ √ √ √
The singular values are σ1 = λ1 = 4 2, σ2 = λ2 = 3 2 and, from
(73),
" # " #
1 T 1 4 1 1
~v1 = A ~u1 = √ = √ ,
σ1 4 2 4 2 1
" # " #
1 T 1 −3 1 −1
~v2 = A ~u2 = √ = √
σ2 3 2 3 2 1

which are indeed orthonormal. We leave it as an exercise to derive a


SVD using, instead, A T A.
Note that we can change the signs of ~u1 and ~u2 in (74), and they
still serve as orthonormal eigenvectors. This implies that SVD is not
unique. However, changing the sign of ~ui changes the sign of ~vi in
(73) accordingly, therefore the product ~ui~viT remains unchanged.
Another source of non-uniqueness arises when we have repeated
singular values, as illustrated in the next example.
Example 3: To find a SVD for
" #
1 0
A=
0 −1

note that AA T is the identity matrix, which has repeated eigenvalues


at λ1 = λ2 = 1 and admits any pair of orthonormal vectors as
eigenvectors. We parameterize all such pairs as
" # " #
cos θ − sin θ
~u1 = ~u2 = (75)
sin θ cos θ
ee16b notes spring’17 37

where θ is a free parameter. Since σ1 = σ2 = 1, we obtain from (73):


" # " #
1 T cos θ 1 T − sin θ
~v1 = A ~u1 = ~v2 = A ~u2 = . (76)
σ1 − sin θ σ2 − cos θ

Thus, (75)-(76) with σ1 = σ2 = 1 constitute a valid SVD for any choice


of θ. You can indeed verify that
" # " #" #
h i ~v T cos θ − sin θ cos θ − sin θ
T T 1
~u1~v1 + ~u2~v2 = ~u1 ~u2 =
~v2T sin θ cos θ − sin θ − cos θ
" #
1 0
= . (77)
0 −1

Geometric Interpretation of SVD

To develop a geometric interpretation of SVD, we first rewrite (63) as

A = U1 SV1T (78)
h i h i
where U1 = ~u1 · · · ~ur is m × r, V1 = ~v1 · · ·~vr is n × r, and S is the
r × r diagonal matrix with entries σ1 , . . . , σr .
Next we form the m × m orthonormal matrix

U = [U1 U2 ]

where the columns of U2 = [~ur+1 · · · ~um ] are eigenvectors of


AA T corresponding to zero eigenvalues. Likewise we define V2 =
[~vr+1 · · · ~vn ] whose columns are orthonormal eigenvectors of A T A
for zero eigenvalues, and obtain the n × n orthogonal matrix

V = [V1 V2 ].

Then we write

" #
S 0r×(n−r)
A=U VT (79)
0(m−r)×r 0(m−r)×(n−r)
| {z }

which is identical to (78) but exhibits square and orthonormal matri-


ces U and V T that enable the geometric interpretation below.
Note that multiplying a vector by an orthonormal matrix does not
change its length. This follows because U T U = I, which implies

kU~x k2 = (U~x )T (U~x ) = ~x T U T U~x = ~x T~x = k~x k2 .


38 murat arcak

Thus we can interpret multiplication by an orthonormal matrix as a


combination of operations that don’t change length, such as rotations,
and reflections.
Since S is diagonal with entries σ1 , . . . , σr , multiplying a vector by Σ
defined in (79) stretches the first entry of the vector by σ1 , the second
entry by σ2 , and so on.
Combining these observations we interpret A~x as the composition of
three operations:
1) V T~x which reorients ~x without changing its length,
2) ΣV T~x which stretches the resulting vector along each axis with the
corresponding singular value,
3) UΣV T~x which again reorients the resulting vector without chang-
ing its length.
The figure below illustrates these three operations moving from the
right to the left:

A= U Σ VT

σ1~u1
σ2 ~v2
σ2~u2 σ1

~v1

The geometric interpretation above reveals that σ1 is the largest am-


plification factor a vector can experience upon multiplication by A:

if the length of ~x is k~x k = 1 then k A~x k ≤ σ1 .

For ~x = ~v1 we get k A~x k = σ1 with equality because V T~v1 is the first
unit vector which, when multiplied by Σ, gets stretched by σ1 .

Symmetric Matrices

We say that a square matrix Q is symmetric if

Q = QT .

Note that the matrices A T A and AA T we used to compute a SVD for


A are automatically symmetric: using the identities ( AB) T = B T A T
and ( A T ) T = A you can verify ( A T A) T = A T A and ( AA T ) T = AA T .
Below we derive important properties of symmetric matrices that we
used without proof in our SVD procedures.
ee16b notes spring’17 39

A symmetric matrix has real eigenvalues and eigenvectors.

Let Q be symmetric and let

Qx = λx, (80)

that is λ is an eigenvalue and x is an eigenvector. Let λ = a + jb and


define the conjugate λ̄ = a − jb. To show that b = 0, that is λ is real,
we take conjugates of both sides of Qx = λx to obtain

Q x̄ = λ̄ x̄ (81)

where we used the fact that Q is real. The transpose of (81) is

x̄ T Q = λ̄ x̄ T . (82)

Now multiply (80) from the left by x̄ T and (82) from the right by x:

x̄ T Qx = λ x̄ T x
(83)
x̄ T Qx = λ̄ x̄ T x

Since the left hand sides are the same we have λ x̄ T x = λ̄ x̄ T x, and
since x̄ T x 6= 0, we conclude λ = λ̄. This means a + jb = a − jb which
proves that b = 0.
Now that we know the eigenvalues are real we can conclude the
eigenvectors are also real, because they are obtained from the equa-
tion ( Q − λI ) x = 0 where Q − λI is real. 

The eigenvectors can be chosen to be orthonormal.

We will prove this for the case where the eigenvalues are distinct al-
though the statement is true also without this restriction6 . Orthonor- 6
A further fact is that a symmetric
mality of the eigenvectors means they are orthogonal and each has matrix admits a complete set of eigen-
vectors even in the case of repeated
unit length. Since we can easily normalize the length to one, we need eigenvalues and is thus diagonalizable.
only to show that the eigenvectors are orthogonal.
Pick two eigenvalue-eigenvector pairs: Qx1 = λ1 x1 , Qx2 = λ2 x2 ,
λ1 6= λ2 . Multiply Qx1 = λ1 x1 from the left by x2T , and Qx2 = λ2 x2
by x1T :

x2T Qx1 = λ1 x2T x1


(84)
x1T Qx2 = λ2 x1T x2 .

Note that x2T Qx1 is a scalar, therefore its transpose is equal to itself:
x1T Qx2 = x2T Qx1 . This means that the left hand sides of the two
equations above are identical, hence

λ1 x2T x1 = λ2 x1T x2 .
40 murat arcak

Note that x1T x2 = x2T x1 is the inner product of x1 and x2 . Since λ1 6=


λ2 , the equality above implies that this inner product is zero, that is
x1 and x2 are orthogonal. 

The final property below proves our earlier assertion that AA T and
A T A have nonnegative eigenvalues. (Substitute R = A T below for the
former, and R = A for the latter.)

If Q can be written as Q = R T R for some matrix R, then the


eigenvalues of Q are nonnegative.

To show this let xi be an eigenvector of Q corresponding λi , so that

R T Rxi = λi xi .

Next multiply both sides from the left by xiT :

xiT R T Rxi = λi xiT xi = λi k xi k2 .

If we define y = Rxi we see that the left hand side is y T y = kyk2 ,


which is nonnegative. Thus, λi k xi k2 ≥ 0. Since the eigenvector is
nonzero, we have k xi k 6= 0 which implies λi ≥ 0. 

Principal Component Analysis (PCA)

PCA is an application of SVD in statistics that aims to find the most


informative directions in a data set.
Suppose the m × n matrix A contains n measurements from m sam-
ples, for example n test scores for m students. If we subtract from
each measurement the average over all samples, then each column of
A is an m-vector with zero mean, and the n × n matrix
1
AT A
m−1
constitutes what is called the “covariance matrix" in statistics. Recall
that the eigenvalues of this matrix are the singular values of A ex-
cept for the scaling factor m − 1, and its orthonormal eigenvectors
correspond to ~v1 , . . . , ~vn in the SVD of A.
The vectors ~v1 , ~v2 , . . . corresponding to large singular values are
called principal components and identify dominant directions in the
data set along which the samples are clustered. The most significant
direction is ~v1 corresponding to σ1 .
As an illustration, the scatter plot below shows n = 2 midterm scores
in a class of m = 94 students that I taught in the past. The data points
are centered around zero because the class average is subtracted from
ee16b notes spring’17 41

the test scores. Each data point corresponds to a student and those
in the first quadrant (both midterms ≥ 0) are those students who
scored above average in each midterm. You can see that there were
students who scored below average in the first and above average in
the second, and vice versa.

50

40

30 ~v1 direction
20

10

Midterm 2 0

-10

-20

-30

-40

-50
-50 -40 -30 -20 -10 0 10 20 30 40 50

Midterm 1

For this data set the covariance matrix is:


" #
1 T 297.69 202.53
A A=
93 202.53 292.07

where the diagonal entries correspond to the squares of the standard


deviations 17.25 and 17.09 for Midterms 1 and 2, respectively. The
positive sign of the (1, 2) entry implies a positive correlation between
the two midterm scores as one would expect.
The singular values of A, obtained from the square roots of the eigen-
values of A T A, are σ1 = 215.08 , σ2 = 92.66, and the corresponding
eigenvectors of A T A are:
" # " #
0.7120 −0.7022
~v1 = ~v2 = .
0.7022 0.7120

The principal component ~v1 is superimposed on the scatter plot


and we see that the data is indeed clustered around this line. Note
that it makes an angle of tan−1 (0.7022/0.7120) ≈ 44.6◦ which is
skewed slightly towards the Midterm 1 axis because the standard
deviation in Midterm 1 was slightly higher than in Midterm 2. We
may interpret the points above this line as students who performed
better in Midterm 2 than in Midterm 1, as measured by their scores
relative to the class average that are then compared against the factor
tan(44.6◦ ) to account for the difference in standard deviations.
42 murat arcak

The ~v2 direction, which is perpendicular to ~v1 , exhibits less variation


than the ~v1 direction (σ2 = 92.66 vs. σ1 = 215.08 ), but enough to
convince you that you can do better on the final!
Sampling and Interpolation

Regression vs. Interpolation

Given data points ( xi , yi ), i = 1, · · · , n, interpolation is the task of


finding a function that exactly matches the data points as shown in
the figure below (right). This differs from regression whose aim is to
choose an approximate fit to data from among a class of functions as
in the figure (left). The least squares method you studied in 16A is a
commonly used form of regression.

y y

regression interpolation

x x

Regression is meaningful when the data are inaccurate; for example


when we have noisy measurements that cluster around a line rather
than lying exactly on a line.
Interpolation is preferable when the data are accurate and we believe
the variation is the result of the core phenomenon that the data rep-
resents rather than noise. For example, when zooming in on a digital
image, an algorithm interpolates between existing pixels to fill in the
pixels between them.
Interpolation is performed using a family of functions, such as poly-
nomials, to predict what happens between the data points.
44 murat arcak

Polynomial Interpolation

If we have two data points ( x1 , y1 ), ( x2 , y2 ) we can find a line y =


a0 + a1 x that exactly matches these points, that is

a0 + a1 x1 = y1 , a0 + a1 x2 = y2 .

To find a0 and a1 , rewrite the two equations above in matrix form as


" #" # " #
1 x1 a0 y
= 1 (85)
1 x2 a1 y2

and note that the matrix " #


1 x1
1 x2
is invertible when x1 6= x2 .
For three data points ( x1 , y1 ), ( x2 , y2 ), ( x3 , y3 ) we can find a quadratic
polynomial y = a0 + a1 x + a2 x2 by solving for a0 , a1 , a2 from
    
1 x1 x12 a0 y1

1 x x 2   a  = y  . (86)
 2 2  1  2
1 x3 x3 2 a2 y3

Similarly, for four data points ( x1 , y1 ), ( x2 , y2 ), ( x3 , y3 ), ( x4 , y4 ), we


look for a cubic polynomial y = a0 + a1 x + a2 x2 + a3 x3 and solve for
a0 , a1 , a2 , a3 from

1 x1 x12 x13
    
a0 y1
1 x x 2 x 3   a   y 
2 2 2  1 =  2 . (87)

1 x3 x32 x33   a2  y3 
    

1 x4 x42 x43 a3 y4

We will see below that the matrices in the two equations above are
invertible if xi 6= x j when i 6= j, that is if the xi values are distinct.
The results of this procedure are illustrated in the figure below for
three data points (left) and four data points (right).

6 8

5 2nd order polynomial 3rd order polynomial


6
through 3 points through 4 points
4
4
3
2
2

1 0

0 -2
0 1 2 3 4 0 1 2 3 4 5
ee16b notes spring’17 45

Generalizing the arguments above to n data points we reach the


following conclusion:

Given ( xi , yi ), i = 1, · · · , n, where xi 6= x j when i 6= j, there is a


unique polynomial of order (n − 1) passing through these points:
y = a 0 + a 1 x + a 2 x 2 + · · · + a n −1 x n −1 .

We solve for the n coefficients a0 , a1 , . . . , an−1 from

x12 x1n−1
    
1 x1 ··· a0 y1
1
 x2 x22 ··· x2n−1    a1   y2 
   
1 x3 x32 ··· x3n−1   a2  =  y3  .
     
(88)
 .. .. .. .. ..   ..   .. 
    
. . . . .   .   . 
1 xn xn2 ··· xnn − 1 a n −1 y n −1
| {z }
V

The matrix V is known as a Vandermonde matrix in linear algebra


and its determinant is given by

det(V ) = ∏ ( x j − x i ), (89)
1≤ i < j ≤ n

which is ( x2 − x1 ) for n = 2, ( x2 − x1 )( x3 − x1 )( x3 − x2 ) for n = 3,


and so on7 . Since we assumed xi 6= x j when i 6= j, we conclude that 7
Verify this formula for n = 2 and
the determinant (89) is nonzero and, thus, V is invertible. n = 3 by calculating the determinant of
the matrices in (85) and (86).

Example 1: To find a cubic polynomial y = a0 + a1 x + a2 x2 + a3 x3


passing through the four points (−1, 1), (0, 0), (1, 1), (2, 2), set up the
equation (87):
    
1 −1 1 −1 a0 1
1 0 0 0   a  0
  1  
  =  .

1 1 1 1   a2  1

1 2 4 8 a3 2
| {z }
V
By inverting the matrix V we obtain
      
a0 0 12 0 0 1 0
a 
 1 1  −4
 −6 12 −2
 0  1/3 
   
 =   =  .
 a2  12  6 −12

6 0  1  1 
a3 −2 6 −6 2 2 −1/3
| {z }
V −1

Thus interpolation gives the polynomial y = 31 x + x2 − 13 x3 , as shown


in the figure below (left).
46 murat arcak

3 y = 31 x + x2 − 13 x3 3 y = 0.3 − 0.1x + 0.5x2

2 2

1 1

0 0

-1 0 1 2 -1 0 1 2

As a comparison we next perform a quadratic regression, that is look


for a quadratic polynomial y = a0 + a1 x + a2 x2 that passes close to
the points (−1, 1), (0, 0), (1, 1), (2, 2). If we attempt to exactly match
these points we get the overdetermined equation

   
1 −1 1   1
1 a0
0 0   0
 
  a1  =  
 

1 1 1 1
a2
1 2 4 2
| {z }
S

which has no solution. Instead, we find the least squares solution


that minimizes the magnitude of the error between the left- and
right-hand sides of the equation above:

 
  1  
a0 0 0.3
T −1 T  
 a1  = (S S) S   = −0.1 .
   
1
a2 0.5
2

Thus quadratic regression gives the polynomial y = 0.3 − 0.1x + 0.5x2 ,


depicted in the figure above (right). 

A shortcoming of polynomial interpolation is that, as n gets larger,


the polynomial has terms with large powers (up to n − 1) that grow
very fast. This makes the interpolation erratic and unreliable, espe-
cially near the end points. The figure below illustrates this behavior
with a polynomial interpolation through n = 12 points.
ee16b notes spring’17 47

80

11th order polynomial


60
through 12 points
40

20

-20

-40

-60

-80
0 2 4 6 8 10 12 14

Interpolation with Basis Functions

An alternative method is to assign to each xi a function φi (·) that


satisfies:
φi ( xi ) = 1 and φi ( x j ) = 0 when j 6= i (90)
and to interpolate between the data points ( xi , yi ) with the function:

y= ∑ yk φk (x). (91)
k

When x = xi this expression yields y = yi as desired, because


φk ( xi ) = 0 except when k = i.
We refer to φi ( x ) as “basis functions" since our interpolation consists
of a linear combination of these functions. Basis functions restrict
the behavior of the interpolation between data points and avoid the
erratic results of polynomial interpolation. The figure below uses
triangular basis functions which lead to a linear interpolation.

y
y2 φ2 ( x )
y3 φ3 ( x )
y4 φ4 ( x )
y1 φ1 ( x )

x
x1 x2 x3 x4

y = ∑k yk φk ( x )

x
x1 x2 x3 x4
48 murat arcak

For simplicity we henceforth assume xi are in increasing order and


evenly spaced:
xi+1 − xi = ∆ for all i.
This allows us to obtain basis functions φi ( x ) by shifting a single
function φ( x ):
φi ( x ) = φ( x − xi ). (92)
Note that (90) holds if we define φ( x ) such that

φ (0) = 1 and φ(k∆) = 0 when k 6= 0. (93)

Linear Interpolation

When φ( x ) is as depicted on the right, that is


1
(
|x|
1 − ∆ |x| ≤ ∆
φ( x ) =
0 otherwise,
x
and the basis functions are obtained from (92), then the interpolation
−∆ ∆
(91) connects the data points with straight lines. (See figure above.)

Zero Order Hold Interpolation


1

When (
1 x ∈ [0, ∆)
φ( x ) = x
0 otherwise
0 ∆
as depicted on the right, the interpolation (91) keeps y constant be-
tween the data points:

y
y2
y3
y4
y1

x
x1 x2 x3 x4

Sinc Interpolation

The sinc function is defined as


(
sin(πx )
x 6= 0
sinc( x ) , πx
1 x=0
sin(πx )
and depicted below. It is continuous since limx→0 πx = 1, and
vanishes whenever x is a nonzero integer.
ee16b notes spring’17 49

sinc( x )
1

x
-3 -2 -1 1 2 3

In sinc interpolation we apply (91) with

φ( x ) = sinc( x/∆).

To illustrate this, the first plot below superimposes yi φ( x − xi ) for


three data points i = 1, 2, 3. The second plot adds them up (blue
curve) to complete the interpolation.

y2
y3
y1

x
∆ 2∆ 3∆

x
∆ 2∆ 3∆

The interest in sinc interpolation is due to its smoothness – contrast


the blue curve above with the kinks of linear interpolation and the
discontinuities of zero order hold interpolation.
To make this smoothness property more explicit we use the identity

1
Z π
sinc( x ) = cos(ωx )dω (94)
π 0

which you can verify by evaluating the integral. Viewing this integral
as an infinite sum of cosine functions, we see that the fastest varying
component has frequency ω = π. Thus the sinc function can’t exhibit
variations faster than this component.
Functions that involve frequencies smaller than some constant are
called “band-limited." This notion is made precise in EE 120 with
continuous Fourier Transforms. For 16B it is sufficient to think of a
band-limited signal as one that can be written as a sum or integral of
sinusoidal components whose frequencies lie in a finite band, which
is [0, π ] for the sinc function in (94).
50 murat arcak

Sampling Theorem

Sampling is the opposite of interpolation: given a function f (·) we


evaluate it at sample points xi :

yi = f ( xi ) i = 1, 2, 3, . . .

Sampling is critical in digital signal processing where one uses sam-


ples of an analog sound or image. For example, digital audio is often
recorded at 44.1 kHz which means that the analog audio is sampled
44,100 times per second; these samples are then used to reconstruct
the audio when playing it back. Similarly, in digital images each pixel
corresponds to a sample of an analog image.
An important problem in sampling is whether we can perfectly re-
cover an analog signal from its samples. As we explain below, the
answer is yes when the analog signal is band-limited and the interval
between the samples is sufficiently short.
Suppose we sample the function f : R → R at evenly spaced points

xi = ∆i, i = 1, 2, 3, . . .

and obtain
yi = f (∆i ) i = 1, 2, 3, . . .
Then sinc interpolation between these data points gives:

fˆ( x ) = ∑ yi φ(x − ∆i) (95)


i

where
φ( x ) = sinc( x/∆),
which is band-limited by π/∆ from (94). This means that fˆ( x ) in (95)
contains frequencies ranging from 0 to π/∆.
Now if f ( x ) involves frequencies smaller than π/∆, then it is reason-
able to expect that it can be recovered from (95) which varies as fast
as f ( x ). In fact the shifted sinc functions φ( x − ∆i ) form a basis for
the space of functions8 that are band-limited by π/∆ and the formula 8
for technical reasons this space is also
(95) is simply the representation of f ( x ) with respect to this basis. restricted to square integrable functions

Sampling Theorem: If f ( x ) is band-limited by frequency


π
ωmax < (96)

then the sinc interpolation (95) recovers f ( x ), that is fˆ( x ) = f ( x ).

By defining the sampling frequency ωs = 2π/∆, we can restate the


condition (96) as:
ωs > 2ωmax
ee16b notes spring’17 51

which states that the function must be sampled faster than twice its
maximum frequency. The Sampling Theorem was proven by Claude
Shannon in the 1940s and was implicit in an earlier result by Harry
Nyquist. Both were researchers at the Bell Labs.

Example 2: Suppose we sample the function


 

f ( x ) = cos x
3
Claude Shannon (1916-2001)
with period ∆ = 1. This means that we take 3 samples in each period
of the cosine function, as shown in the figure below. Since ωmax = 2π
3
and ∆ = 1, the criterion (96) holds and we conclude that the sinc
interpolation (95) exactly recovers f ( x ).

1 2 x
3
Harry Nyquist (1889-1976)

Example 3: Suppose now the function being sampled is


 

f ( x ) = cos x . (97)
3

With ωmax = 4π 3 and ∆ = 1, the criterion (96) fails. To see that the
result of the sinc interpolation fˆ( x ) is now different from f ( x ), note
that this time we take 3 samples every two periods of the cosine func-
tion, as shown below. These samples are identical to the 3 samples
collected in one period of the function in Example 2 above. Therefore,
sinc interpolation gives the same result it did in Example 2:
 

fˆ( x ) = cos x
3

which does not match (97).

fˆ( x )
f (x)
1 2 x
3
52 murat arcak

Aliasing and Phase Reversal

In Example 3 the low frequency component 2π/3 appeared in fˆ( x )


from the actual frequency 4π/3 of f ( x ) that exceeded the critical
value π/∆ = π. The emergence of phantom lower frequency compo-
nents as a result of under-sampling is known as “aliasing."
To generalize Example 3 suppose we sample the function

f ( x ) = cos (ωx + φ) (98)

with period ∆ = 1 and obtain

yi = cos (ωi + φ) .

Using the identity cos(2πi − θ ) = cos(θ ) which holds for any integer
i, and substituting θ = ωi + φ. we get

yi = cos (2πi − ωi − φ) = cos((2π − ω )i − φ)

which suggests that the samples of the function

cos ((2π − ω ) x − φ) (99)

are identical to those of (98).


If ω ∈ (π, 2π ] in (98) then sinc interpolation gives the function in
(99) whose frequency is 2π − ω ∈ [0, π ). This function changes more
slowly than (98) and the sign of the phase φ is reversed. These effects
are visible in movies where a rotating wheel appears to rotate more
slowly and in the opposite direction when its speed exceeds half of
the sampling rate (18-24 frames/second).

Example 4: Suppose we sample the function

f ( x ) = sin (1.9πx )

with ∆ = 1 as shown in the figure below. This function is of the form


(98) with ω = 1.9π and φ = −π/2 because

sin (1.9πx ) = cos (1.9πx − π/2) .

Thus, from (99), the sinc interpolation gives

fˆ( x ) = cos (0.1πx + π/2) = − sin (0.1πx )

as evident from the samples in the figure. Note that the negative sign
of − sin (0.1πx ) is a result of the phase reversal discussed above.
ee16b notes spring’17 53

0.8

0.6

0.4

0.2

f (x) 0

-0.2

-0.4

-0.6

-0.8

-1
0 2 4 6 8 10 12 14 16 18 20
x
Example 5: Note that the inequality in (96) is strict. To see that the
Sampling Theorem does not hold when ωmax = π ∆ suppose f ( x ) =
sin(πx ) and ∆ = 1. Then the samples are

yi = sin(πi ) = 0, i = 1, 2, 3, . . .

Since all samples are zero, sinc interpolation gives

fˆ( x ) = 0

and does not recover f ( x ) = sin(πx ).

Discrete-Time Control of Continuous-Time Systems

In a typical application the control algorithm for a continuous-time


physical system is executed in discrete-time. Thus, the measured
output must be sampled before being fed to the control algorithm.
Conversely, the discrete-time control input generated by the algo-
rithm must be interpolated into a continuous-time function, typically
with a zero order hold, before being applied back to the system.
This scheme is depicted in the block diagram below. We let T denote
the sampling period and represent the samples of the output y(t) at
t = kT, k = 0, 1, 2, . . . by

yd (k) = y(kT )

where the subscript “d" stands for discrete-time. The control se-
quence generated in discrete time is denoted ud (k) and is interpo-
lated by the zero order hold block to the continuous-time input

u(t) = ud (k ) t ∈ [kT, (k + 1) T ). (100)


54 murat arcak

zero order u(t) continuous-time y(t)


ud (k ) sampling yd (k) = y(kT )
hold system

discrete-time
control

To design a discrete-time control algorithm we need to represent


the continuous-time system, combined with the zero order hold and
sampling blocks, with a discrete-time model. This combination is
depicted with the dashed box in the figure above, with input ud (k)
and output yd (k).
Suppose the continuous-time system model is

d
~x (t) = A~x (t) + Bu(t)
dt (101)
y(t) = C~x (t)

and we wish to obtain a discrete-time model

~xd (k + 1) = Ad~x (k) + Bd ud (k)


(102)
yd (k) = Cd~xd (k)

where ~xd (k) is the value of the state ~x (t) at time t = kT. It follows
that Cd = C because

yd (k) = y(kT ) = C~x (kT ) = C~xd (k ).

To see how Ad and Bd in (102) can be obtained let’s first assume A =


a and B = b are scalars. Recall that the solution of the differential
equation (101) with initial condition x (0) is
Z t
x (t) = e at x (0) + b e a(t−s) u(s)ds. (103)
0

Since u(s) is constant in the interval s ∈ [0, T ) and equal to ud (0), the
solution at t = T is

e aT − 1
x ( T ) = e aT x (0) + b u d (0)
| {z } |{z} a
x d (1) x d (0)

and a generalization of this argument shows

e aT − 1
xd (k + 1) = e aT xd (k) + b u d ( k ).
a
ee16b notes spring’17 55

Thus we conclude that


e aT − 1
Ad = e aT and Bd = b.
a

Next assume A is not scalar but diagonal, and B is an arbitrary col-


umn vector:    
λ1 b1
 .  .
A=  ..  B =  ..  .
  
λn bn
Recall that any linear system where A is diagonalizable can be
brought to this form with a change of state variables.
Then (101) decouples into scalar differential equations
d
x ( t ) = λ i x i ( t ) + bi u ( t ) i = 1, . . . , n
dt i
and we conclude from the arguments above that
e λi T − 1
xd,i (k + 1) = eλi T xd,i (k) + bi u d ( k ) .
λi
Concatenating xd,i , i = 1, . . . , n, into the vector ~xd we obtain the
discrete-time model (102) with
 λ1 T
−1
  
e
e λ1 T λ1 b1
Ad = 
 .. 
 B=
 .. 
.
 .   . 
eλn T e λ n T −1
λn b n

A natural question to ask is whether stability of the continuous-


time model implies stability of the discretized model. To see that the
answer is yes note that an eigenvalue of A at

λ = v + jω

maps to an eigenvalue of Ad at

λd = eλT = evT e jωT

whose magnitude is
|λd | = evT .
Thus, if λ satisfies the continuous-time stability criterion

Re(λ) = v < 0

then λd satisfies the discrete-time stability criterion

|λd | = evT < 1.


Indeed, as depicted in the figure below, λ 7→ eλT maps the imaginary
axis in the complex plane to the unit circle, and the left hand side of
the imaginary axis to the interior of the unit circle.
56 murat arcak

Im(λ) Im(eλT )
eλT

Re(λ) Re(eλT )

Although stability is maintained, controllability and observability


properties may not be preserved when we control and observe a
system in discrete time. You will investigate the potential loss of
observability in a homework problem.
Discrete Fourier Transform (DFT)

Discrete-Time Signals as Vectors

Consider a discrete-time signal x (t) that consists of N samples, t =


0, 1, . . . , N − 1. To prepare for the Discrete Fourier Transform to be
introduced later we interpret this signal as a vector,
 
x (0)
 x (1) 
 
~x = 
 .. .
.

 
x ( N − 1)

This viewpoint allows us to define the inner product of two signals


x (t) and y(t) as
N −1
~x T~y = ∑ x (t)y(t)
t =0

and to declare two signals to be orthogonal when this inner product


is zero. For example, you should be able to verify by inspection that
the eight signals depicted below are orthogonal to each other.
Interpreting discrete time signals as vectors allows us to introduce
new "basis signals" such as those depicted below, which provide an
orthogonal basis for length-8 sequences. Special basis functions are
commonly used in compressing images, videos, soundtracks, etc.
As an illustration consider a 10-second soundtrack recorded at 44.1
kHz, which contains 444, 100 samples. Instead of viewing this signal
as a linear combination of the standard basis signals {1, 0, 0 . . . },
{0, 1, 0, . . . }, {0, 0, 1, · · · }, . . . , each multiplied by the value of the
corresponding sample, we can choose a different basis where some
of the signals are less important for the sound quality than others,
e.g. high frequency sinusoidal signals that are inaudible. This allows
one to reduce the file size by either ignoring the coefficients of the
insignificant basis signals or by quantizing them with fewer bits.
58 murat arcak

1 1

0 0

-1 -1

0 2 4 6 0 2 4 6

1 1

0 0

-1 -1

0 2 4 6 0 2 4 6

1 1

0 0

-1 -1

0 2 4 6 0 2 4 6

1 1

0 0

-1 -1

0 2 4 6 0 2 4 6

Example 1: The "Discrete Cosine Transform" (DCT) has been em-


ployed in standards for image and video compression, such as JPEG9 9
Joint Photographic Experts Group
and MPEG10 . One type of DCT, called DCT-2, represents a signal as a 10
Moving Picture Experts Group
linear combination of the basis signals

r r  
1 2 πk
v0 ( t ) = , vk (t) = cos (2t + 1) k = 1, · · · , N − 1,
N N 2N

where larger k indicates a higher frequency. The first four of these


basis signals (k = 0, 1, 2, 3) are depicted below.

The following identity, whose proof is omitted, shows that the basis
signals defined above are orthonormal:


N −1    N
 if k = m = 0
πk  πm 
∑ cos
2N
( 2t + 1 ) cos
2N
( 2t + 1 ) = N
2 if k = m 6= 0
t =0

 0 if k 6= m.
ee16b notes spring’17 59

v0 ( t ) v1 ( t )
0.4 0.4

0.2 0.2

0 0

-0.2 -0.2

-0.4 -0.4
0 5 10 15 0 5 10 15

v2 ( t ) v3 ( t )
0.4 0.4

0.2 0.2

0 0

-0.2 -0.2

-0.4 -0.4
0 5 10 15 0 5 10 15

Given orthonormal basis vectors ~v0 , . . . , ~v N −1 we can express any


vector ~x as a linear combination

~x = α0~v0 + · · · + α N −1~v N −1 (104)

and obtain the coefficients from the inner product

αk = ~vkT~x.

This follows from orthonormality: if we multiply both sides of (104)


by ~vkT all terms in the right hand side vanish, except αk~vkT~vk = αk .
Similarly, given N orthonormal basis signals v0 (t), . . . , v N −1 (t) we
can express any signal x (t) as a linear combination

x ( t ) = α 0 v 0 ( t ) + · · · + α N −1 v N −1 ( t ) t = 0, 1, . . . , N − 1

and obtain the coefficients αk from the inner product


N −1
αk = ∑ v k ( t ) x ( t ).
t =0

We can then store the coefficients α0 , . . . , α N −1 instead of the sig-


nal values x (0), . . . , x ( N − 1). This is the premise of compression
algorithms that store only the coefficients corresponding to basis
functions that are important for the quality of sound, image, etc.
The Discrete Fourier Transform (DFT) is similar in spirit to the Dis-
crete Cosine Transform but, as we will see, it uses complex valued
basis signals. Therefore, before proceeding to DFT, we adapt the
definition of inner products to complex vectors.
60 murat arcak

Complex Inner Products

For complex valued vectors ~x and ~y the appropriate inner product is

~x ∗~y

where ~x ∗ is the conjugate transpose which means that, in addition to


transposing, we take the complex conjugate. As an illustration,
" #
1 h i h i
~x = ⇒ ~x T = 1 j ~x ∗ = 1 − j . (105)
j

For a real-valued ~x there is no difference between ~x ∗ and ~x T , as the


complex conjugate of a real number is itself. Note that

~x ∗~x = k~x k2

which follows because ~x ∗~x = ∑i x (i )∗ x (i ) = ∑i | x (i )|2 . For the



example in (105), ~x ∗~x = 1 − j2 = 2 which means k~x k = 2. By
contrast, ~x T~x = 1 + j2 = 0 which shows the necessity of conjugation
when defining complex inner products.
Now if ~v0 , . . . , ~v N −1 are complex valued and orthonormal, that is
(
∗ 1 if k = m
~vk ~vm =
0 if k 6= m,

then the coefficients in the decomposition (104) become

αk = ~v∗k ~x. (106)

Discrete Fourier Transform (DFT)

The DFT uses the basis signals

1
uk (t) , √ e jkωt , k = 0, 1, . . . , N − 1 where ω= 2π
N (107)
N

which we can rewrite as11 11


using the identity e jθ = cos θ + j sin θ

1 1
uk (t) = √ cos(kωt) + j √ sin(kωt).
N N

The DFT basis is similar to DCT in that it consists of sinusoids of


varying frequencies, but differs due to its complex values. The inter-
est in DFT is because of computational efficiency12 and, as we will 12
A class of algorithms known as Fast
see later, because it facilitates the analysis of linear time-invariant Fourier Transforms has been developed
to perform the DFT.
systems.
ee16b notes spring’17 61

Finding the DFT of x (t) means finding coefficients X (k), k = 0, 1, . . . , N −


1, to represent x (t) as a linear combination of uk (t):

N −1
x (t) = ∑ X ( k ) u k ( t ). (108)
k =0

Example 2 (N = 2): Consider the signal

x (0) = 2, x (1) = 3.

Since the duration is N = 2 we have ω = π,


1 1 1 1
u0 (t) = √ e j0t = √ and u1 (t) = √ e jπt = √ (−1)t .
2 2 2 2
We view x (t), u0 (t), u1 (t) as length-two vectors whose entries are the
values that each sequence takes at t = 0, 1:
" # " # " #
2 1 1 1 1
~x = , ~u0 = √ , ~u1 = √ .
3 2 1 2 −1

Then DFT becomes a change of basis

~x = X (0)~u0 + X (1)~u1

similar to (104). Since ~u0 and ~u1 are real and orthonormal, that is
~u0T~u1 = 0 and ~u0T~u0 = ~u1T~u1 = 1, we get

5 1
X (0) = ~u0T~x = √ X (1) = ~u1T~x = − √ .
2 2


Example 3 (N = 4): When the duration is N = 4 we have ω = N =
π
2:

1 j0t 1
u0 ( t ) = e =
2 2
1 jπt 1
u1 ( t ) = e 2 = ( j ) t
2 2
1 π 1
u2 (t) = e j2 2 t = (−1)t
2 2
1 j3 π t 1
u3 (t) = e 2 = (− j)t .
2 2
We view u0 (t), . . . , u3 (t) as length-four vectors whose entries are the
values that each sequence takes at t = 0, 1, 2, 3:
       
1 1 1 1
1 1  1 j  1 −1  1 −j 
   
~u0 =   ~u1 =   ~u2 =   ~u3 =  .
2 1  2  −1  2 1  2  −1 
1 −j −1 j
62 murat arcak

To find X (k ), k = 0, 1, 2, 3, such that


 
x (0)
 x (1) 
 = X (0)~u0 + X (1)~u1 + X (2)~u2 + X (3)~u3
 
x (2)

 
x (3)

we will again use the orthonormality of the basis vectors ~u0 , . . . , ~u3 .
You can indeed show that
(
0 k 6= m
~u∗k ~um =
1 k = m.

Using orthonormality as in (106) we can find the coefficients X (k)


from  
x (0)
 x (1) 
X (k) = ~u∗k 
 
 x (2) 

x (3)
and combine this equation for k = 0, 1, 2, 3 into
    
X (0) 1 1 1 1 x (0)
 X (1)  1 1 −j −1 j  x (1) 
= 
    
X (2) 2 −1 −1 x (2)
  
  1 1  
X (3) 1 j −1 −j x (3)

where the first row of is ~u0∗ , the second row is ~u1∗ , and so on.
As an illustration, for the sequence x (0) = 1, x (1) = x (2) = x (3) = 0,
we find
1
X (0) = X (1) = X (2) = X (3) = .
2
The summation of u0 (t), . . . , u3 (t) with these weights indeed recovers
x (t) as shown in the figure below.

Orthonormality of the DFT Basis

In both examples (N = 2 and N = 4) we made use of the orthonor-


mality of the DFT basis. We now show that this is a general property
that holds for any N. To simplify the notation we define

Wk , e jk N (109)
ee16b notes spring’17 63

1
2 u0 ( t )

1
2 u1 ( t )

1
2 u2 ( t )

1
2 u3 ( t )

+
x (t) 1

imaginary parts cancel out


64 murat arcak

Im
and rewrite (107) as Wk

1
uk (t) , √ Wkt , k = 0, 1, . . . , N − 1,
N
k 2π
N 1
Re
or as the vector  
1

 Wk 

1  Wk 2

~uk = √  .
N .. 
.
 
 
( N −1)
Wk
To see that these vectors form an orthonormal basis, note that
N −1 N −1 N −1
1 1 2π 1
~u∗k ~um =
N ∑ (Wkt )∗ Wmt =
N ∑ e j(m−k) N t =
N ∑ Wmt −k
t =0 t =0 t =0

2π 2π
where the second equality follows from (Wkt )∗ = (e jk N t )∗ = e− jk N t .

Now, if m = k, e j(m−k) N t = 1 and the summation gives N. If m 6= k
the summation gives zero because the numbers Wmt −k , t = 0, . . . , N −
1 are spread evenly around the unit circle and add up to zero, as
illustrated on the right for m − k = 1 and N = 6. Thus, W12 W1
(
∗ 0 k 6= m
~uk ~um = (110)
1 k = m.
W13 W10

DFT Analysis and Synthesis Equations


W14 W15
Recall that the DFT representation of the sequence x (t) is
 
x (0)

 x (1) 

x (2)
 
  = X (0)~u0 + X (1)~u1 + · · · + X ( N − 1)~u N −1 . (111)
..
 
 
 . 
x ( N − 1)

To determine X (k) we multiply both sides of this equation by ~u∗k and


use the orthonormality property (110) to obtain:
 
x (0)

 x (1) 

~u∗k  x (2)  = X (k)~u∗~uk = X (k).
 
k
..
 
 
 . 
x ( N − 1)
ee16b notes spring’17 65

Thus, stacking up X (0), . . . , X ( N − 1) in a vector gives the formula:

~u0∗
    
X (0) x (0)

 X (1)  
  ~u1∗ 
 x (1) 

X (2) ~u2∗ x (2)
    
 =   (112)
.. .. ..
    
    
 .   .  . 
X ( N − 1) ~u∗N −1 x ( N − 1)

which we call the "analysis equation" since it amounts to analyzing


the frequency content of the signal x (t).
Likewise, we rewrite the equation (111) compactly as:
   
x (0) X (0)

 x (1) 
 h
 X (1) 
i 
x (2) X (2)
   
  = ~u0 ~u1 ~u2 · · · ~u N −1  
.. ..
   
  | } 
. .
{z
   
,F
x ( N − 1) X ( N − 1)

and call it the "synthesis equation" since it synthesizes x (t) from the
basis signals.
We refer to the N × N matrix F as the Fourier Matrix. Note that the
matrix in the analysis equation (112) corresponds to F ∗ , because its
rows are conjugate transposes of the columns of F. Since the analysis
equation ~
X = F ∗~x and synthesis equation ~x = F ~
X are inverses of each
other, we conclude
F −1 = F ∗
which means that F is a unitary matrix:

F ∗ F = FF ∗ = I.

Example 4: Recall from Example 3 that, when N = 4, we have


       
1 1 1 1
1 1  1 j  1 −1  1 −j 
~u0 =  ~u1 =   ~u2 =   ~u3 =  .
       
2 2 −1 2 2 −1

1   1  
1 −j −1 j

Thus, for N = 4,
   
1 1 1 1 1 1 1 1
1 1
 j −1 −j  1 1
 −j −1 j 
F=  F∗ =  . (113)
 
2 1 −1 −1 2 1 −1 −1

1 1
1 −j −1 j 1 j −1 −j

You can verify that F ∗ F = FF ∗ = I.


66 murat arcak

Some Properties of DFT

The first two properties below follow directly from (112).


1) Scaling:
If x (t) has DFT coefficients X (k) then, for any constant a, the se-
quence ax (t) has DFT coefficients aX (k ).
2) Superposition:
If x (t) and y(t) have DFT coefficients X (k) and Y (k ) respectively,
then x (t) + y(t) has DFT coefficients X (k ) + Y (k).
3) Parseval’s relation: Given x (t) and its DFT coefficients X (k),
N −1 N −1
∑ | x (t)|2 = ∑ | X (k)|2
t =0 k =0

which means k~x k2 = k ~


X k2 . This follows because ~x = F ~
X where F is

unitary (F F = I) as discussed above and, thus,

k~x k2 = ~x ∗~x = ~X ∗ F ∗ F ~X = ~X ∗ ~X = k ~X k2 .

4) Conjugate symmetry:
When x (t) is real-valued, the DFT coefficients satisfy

X ( N − k ) = X (k )∗ k = 1, . . . , N − 1. (114)

When N = 4, this implies X (3) = X (1)∗ and X (2) = X (2)∗ which


means X (2) is real. You can indeed see from (112) and (113) that,
when x (t) is real, X (2) = 12 ( x (0) − x (1) + x (2) − x (3)) is real and
1 1
X (1) = ( x (0) − x (2)) − j ( x (1) − x (3))
2 2
1 1
X (3) = ( x (0) − x (2)) + j ( x (1) − x (3))
2 2
are complex conjugates.
To see why (114) holds in general first note from (107) that
2π 2π 2π
WN −k = e j( N −k) N = e j2π e− jk N = e− jk N = Wk∗
t t ∗
and, similarly, WN −k = (Wk ) , t = 2, 3, . . . It then follows that
N −1 N −1
X (k) = ~u∗k ~x = ∑ (Wkt )∗ x(t) = ∑ (WNt −k )x(t).
t =0 t =0

Since x (t) is real, we have x (t)∗ = x (t); thus taking the conjugate of
both sides gives
N −1
X (k )∗ = ∑ (WNt −k )∗ x(t) = ~u∗N −k~x = X ( N − k).
t =0
ee16b notes spring’17 67

Example 5: Let x (t) = e jω0 t , t = 0, 1, . . . , N − 1. If


ω0 = k 0 for some integer k0 ∈ {0, 1, . . . , N − 1} (115)
N
then x (t) is identical to the k0 -th basis function, except for the nor-

malization factor N:

x (t) = Nuko (t).

This means that x (t) is recovered from the k0 -th basis function alone:
( √
N if k = k0
X (k) =
0 otherwise.

As a concrete example, if we have the duration N = 100 sequence


x (t) = e j0.2πt , t = 0, 1, . . . , 99, then (115) holds with k0 = 10. Thus

X (10) = 100 = 10 and all other X (k) values are zero. Note that
X (90) 6= X (10)∗ because the conjugate symmetry property (114) does
not hold when x (t) is complex-valued.
The assumption (115) implies that x (t), interpreted as a vector ~x, is
exactly aligned with the k0 -th basis vector ~uk0 . When ω0 is not exactly
equal but close to k0 2π
N , we can expect that ~ x will be approximately
aligned with ~uk0 which means that X (k) peaks around k = k0 and is
smaller away from k0 .
Example 6: Now let x (t) = cos(ω0 t) where ω0 satisfies (115). Rewrit-
ing

1 jω0 t 1 − jω0 t
x (t) = e + e
2 2
1 jω0 t 1 j(2π −ω0 )t
= e + e
2 2
1 jk0 2π t 1 j( N −k0 ) 2π t
= e N + e N
2√ 2 √
N N
= uk0 (t) + u (t)
2 2 N −k0
we conclude
( √
N
2 if k = k0 or k = N − k0
X (k) = (116)
0 otherwise.

As an illustration, for

x (t) = cos(0.2πt), t = 0, 1, . . . , N − 1 (117)

with N = 100 we get X (10) = X (90) = 5 and X (k ) = 0 for all other


k, as depicted below. The conjugate symmetry property (114) is now
satisfied because x (t) is real-valued.
68 murat arcak

To illustrate what happens when (115) does not hold, we next take
N = 101 and plot the real and imaginary parts of the resulting DFT.
As expected, X (k) peaks near k = 10 and k = 90.

X (k) for N = 100


5

0 k

-1
0 10 20 30 40 50 60 70 80 90 100

Real part of X (k) for N = 101


5

0
k

-1
0 10 20 30 40 50 60 70 80 90 100
ee16b notes spring’17 69

Imaginary part of X (k) for N = 101


2

1.5

0.5

0 k
-0.5

-1

-1.5

-2
0 10 20 30 40 50 60 70 80 90 100

Note that the real part of X (k) is even symmetric and the imaginary
part is odd symmetric about the midpoint, N/2, of the k axis. This is
a result of the conjugate symmetry property X ( N − k) = X (k )∗ . The
plot of | X (k)|, shown below, is also even symmetric.

| X (k)| for N = 101


5

4.5

3.5

2.5

1.5

0.5

0
0 10 20 30 40 50 60 70 80 90 100 k
increasing frequency

We make two important observations about DFT plots:


1) The second half of the k axis beyond N/2 repeats the information
contained in the first half due to conjugate symmetry.
2) The midrange of the k axis represents high frequencies. To see this
assume, for simplicity, that N is even and note that the DFT basis
70 murat arcak

signal for k = N/2 is

1 N 2π 1 1
u N/2 (t) = √ e j 2 N t = √ e jπt = √ (−1)t ,
N N N
which varies faster than all other basis signals.
Therefore, the critical part of a DFT plot is the left half where lower
values of k represent low frequencies and higher values approaching
N/2 represent high frequencies.

Linear Time Invariant (LTI) Systems

Consider a system that takes in an input signal u(t) and returns an


output signal y(t) as in the figure below.

u(t)
x(t) y(t)
y(t)

We say that the system is linear if it satisfies the following conditions:


1. Scaling: If an input u(t) generates13 the output y(t), then 13
we will use the notation u(t) → y(t)
as a shorthand for “u(t) generates y(t)"
au(t) → ay(t) for any constant a. (118)

2. Superposition: If u1 (t) → y1 (t) and u2 (t) → y2 (t), then

u1 ( t ) + u2 ( t ) → y1 ( t ) + y2 ( t ). (119)

If the input to a linear system is 0 then the output must be 0 as well.


This follows by choosing a = 0 in (118).
A system is called time invariant if a time shift in the input results is
an identical time shift in the output:

u ( t − T ) → y ( t − T ). (120)

This means that the system reacts the same way to an input applied
later as it would have reacted if the input was applied now.
Example 7: Consider the discrete-time state space model

~x (t + 1) = A~x (t) + Bu(t)


(121)
y(t) = C~x (t)

and recall that the solution ~x (t) for t = 1, 2, 3, . . . is

~x (t) = At~x (0) + At−1 Bu(0) + · · · + ABu(t − 2) + Bu(t − 1).


ee16b notes spring’17 71

Multiplying both sides from the left by C we get

y(t) = CAt~x (0) + CAt−1 Bu(0) + · · · + CABu(t − 2) + CBu(t − 1)

and, if the initial condition ~x (0) is zero, we conclude

y(t) = CAt−1 Bu(0) + · · · + CABu(t − 2) + CBu(t − 1). (122)

This relationship satisfies the scaling and superposition properties;


therefore the system is linear. It is also time invariant because A, B,
C do not depend on time: if we apply the same input starting at time
t = T instead of t = 0, we get the same solution shifted in time by T.

Impulse Response of LTI Systems

Systems that are both linear and time invariant possess many use-
ful properties. One such property is that, if we know the system’s
response to the unit impulse sequence
(
1 if t = 0
δ(t) ,
0 otherwise, δ(t)
1

depicted on the right, we can predict its response to any other input.
t
We denote the impulse response by h(t), that is δ(t) → h(t). To
see how we can use h(t) to predict the system’s response to another
input u(t), rewrite u(t) as

u(t) = ... + u(0)δ(t) + u(1)δ(t − 1) + u(2)δ(t − 2) + ...


= ∑ u ( k ) δ ( t − k ).
k

Since δ(t) → h(t), by time-invariance we have δ(t − k) → h(t − k).


Then, by linearity, ∑k u(k)δ(t − k) → ∑k u(k)h(t − k), therefore

y(t) = ∑ u ( k ) h ( t − k ). (123)
k

This expression is known as the convolution sum and shows how we


can predict the output for any input using the impulse response h(t).
Example 8: For the state space example above, note from (122) that

h(t) = CAt−1 Bδ(0) + · · · + CABδ(t − 2) + CBδ(t − 1) = CAt−1 B

for t ≥ 1, and h(0) = C~x (0) = 0 since we assumed ~x (0) = 0 to ensure


linearity. Thus,

h(0) = 0, h(1) = CB, h(2) = CAB, h(3) = CA2 B, . . .


72 murat arcak

and (122) can be interpreted as a convolution sum.


Example 9: For a LTI system whose output is

u ( t ) + u ( t − 1)
y(t) =
2

the impulse response is zero except at t = 0, 1 where h(0) = h(1) = 21 .


Example 10: Radio waves from a wireless transmitter may be de-
flected by obstacles, creating echoes of the transmitted signal that
reach the receiver with different delays. For example, if there are
three paths, the received signal can be written as

y(t) = α1 u(t − T1 ) + α2 u(t − T2 ) + α3 u(t − T3 )

which includes three copies of the transmitted signal u(t), each with
delay Ti and gain αi , i = 1, 2, 3. In a discrete-time model Ti should
be interpreted as the nearest number of sample periods. This in-
put/output relationship is linear; it is also time invariant if we as-
sume that αi and Ti , i = 1, 2, 3 do not change over time. The impulse
response is obtained by substituting the unit impulse for the input,

h(t) = α1 δ(t − T1 ) + α2 δ(t − T2 ) + α3 δ(t − T3 ),


α1

α2
and is depicted on the right.
α3

t
T1 T2 T3
Finite Impulse Response (FIR) Systems

We now restrict our attention to LTI systems whose impulse response


is of finite length. Specifically we assume

h(t) = 0 when t ∈
/ {0, 1, . . . , M } (124)

for some integer M, so that only h(0), . . . , h( M) can be nonzero.


Likewise we assume a finite length input u(t), t = 0, 1, . . . , L − 1.
It then follows from the convolution sum formula (123) that

L −1
y(t) = ∑ u(k)h(t − k) (125)
k =0

and it can be shown from (124) that

y(t) = 0 when t ∈
/ {0, 1, . . . , M + L − 1}.
ee16b notes spring’17 73

For t ∈ {0, 1, . . . , M + L − 1} we write (125) in matrix form as


 
h (0) 0 ··· 0
y (0)
 
 .. ..

  h (1)

h (0) . 
.
 y (1)  
   .. ..
 u (0)
 ..  
. h (1) .

0   u (1)
.
   
..
    
 .. = ..  .. 
  h( M) . . h (0) 
. .
  
    

 ..
  0
  h( M) h (1)  u ( L − 1)

 .   .. .. .. .. 

. . . .

y ( M + L − 1)  
| {z } 0 ··· 0 h( M)
, ~y
(126)
where each row in the matrix corresponds to a particular t in (125).
Note that if we apply the unit impulse as the input, then

   
u (0) 1
u (1) 0
   
   
 .. = .. 
. .
   
   
u ( L − 1) 0

and multiplication with the matrix in (126) gives

 

y (0)
 h (0)
h (1)
 
 y (1)   

 ..
 
  .. 


.
  . 
   
 .. = h( M) 
.
   
   0 
..
   

.
  .. 
.
   
 
y ( M + L − 1) 0

which, as expected, is the impulse response.


To match the size of the input and output vectors in (126) we aug-
ment the input vector with M zeros,

 T

~u ,  u(0) u(1) · · · u( L − 1) 0| ·{z


· · 0}  , (127)
M zeros

and complete the ( M + L) × L matrix above into a square matrix by


adding M columns. Although the choice of these columns is arbitrary
(they get multiplied by the zero entries of ~u) we preserve the struc-
ture and continue shifting the columns downwards and wrap around
74 murat arcak

the entries from the bottom back to the top:


h (0) ··· h( M) ··· h (1)
 
0 0
 . .. .
.. .. .. 
 h (1)
 h (0) 0 . . 

 .
.. .. .. .. 

 h (1) . 0 . . h( M) 
 .
.. . .. .. 
~y = 
 h( M) h (0) 0 . 0  ~u. (128)


.. .. 
h( M) h (1) h (0) .
 
 0 . 
.. .. ..
 
 .. .. .. 
 . . . . . . 0 
0 ··· 0 h ( M ) h ( M − 1) ··· h (0)
| {z }
,H
The resulting ( M + L) × ( M + L) square matrix H belongs to a class
of matrices called “circulant."

Analyzing LTI Systems with DFT

Circulant Matrices and Diagonalization with DFT Basis

A circulant matrix has the general form


 
c0 c N −1 · · · c2 c1
 c c0 c N −1 c2 
 1 
 . .. .. 
C =  .. c1 c0 . . (129)
 

.. .. ..
 
. .
 
 c N −2 . c N −1 
c N −1 c N −2 ··· c1 c0
which encompasses H in (128) as a special case. Circulant matrices
have the following useful property proven at the end of these notes:
The DFT basis diagonalizes all circulant matrices. Specifically,
 
C (0)
√  C (1)
 
F ∗ CF = N 

..
 (130)
.
 
 
C ( N − 1)

where F is the Fourier matrix defined earlier and


C (0), C (1), . . . , C ( N − 1) are the DFT coefficients of the sequence
c0 , c1 , . . . , c N −1 obtained from the first column.

We now use this property to derive a relation between the input and
output of a LTI system in the DFT basis. Multiplying both sides of
(128) from the left with F ∗ we write:
F ∗~y = F ∗ H~u = F ∗ HFF ∗~u
ee16b notes spring’17 75

where the second equality follows because FF ∗ = I. Since F ∗~y and


F ∗~u give the vector of DFT coefficients ~ ~ this means
Y and U,

~Y = F ∗ HFU.
~

Finally, adapting (130) to the matrix H in (128), we get


    
Y (0) H (0) U (0)
Y (1)  √ H (1) U (1)
    
   
..  = M+L .. ..
     
. . .
  
    
Y ( M + L − 1) H ( M + L − 1) U ( M + L − 1)

where H (0), H (1), . . . , H ( M + L − 1) are the DFT coefficients of the


length M + L sequence obtained from the first column of H:

h(0) h(1) · · · h( M ) 0| ·{z


· · 0} .
L−1 zeros

Likewise, U (0), U (1), . . . , U ( M + L − 1) represent the DFT for the in-


put in (127) which has been “padded" with M zeros so that it has the
same length as the output and, thus, has as many DFT coefficients.
Because the matrix H in (128) is now diagonalized we simply multi-
ply the DFT coefficients of the input and the DFT coefficients of the
impulse response to obtain the DFT coefficients of the output:

Y (k) = M + L H ( k )U ( k ) k = 0, 1, . . . , L + M − 1. (131)

We can then reconstruct y(t) from its DFT Y (k). This method is
preferable to the convolution sum performed in (128) since DFT is
computed efficiently with FFT algorithms.

Summary: In the DFT basis a LTI system simply scales the DFT
coefficients of the input. Each frequency component k is scaled by
a factor H (k) that comes from the DFT of the impulse response.

Example 11: Suppose we apply 100 samples of the signal

u(t) = cos(0.1πt) + 0.5 cos(πt) t = 0, 1, . . . , 99

to a LTI system whose impulse response is


(
1
h(t) = 4 t = 0, 1, 2, 3
0 otherwise.

To find the output y(t), we pad three zeros to the input and take the
DFT of the resulting length 103 sequence. Likewise we pad 99 zeros
to the length four impulse response and calculate its DFT. The figure

below shows |U (k )| (top) and 103 | H (k)| (middle), as well as their
product (bottom) which gives |Y (k )| from (131).
76 murat arcak

6
|U (k)|
4

0
0 10 20 30 40 50 60 70 80 90 100

1

103 | H (k)|
0.5

0
0 10 20 30 40 50 60 70 80 90 100

|Y (k)|
4

0
0 10 20 30 40 50 60 70 80 90 100

We see that the spikes around k = 51 and 52 (corresponding to the


high frequency π) are eliminated in the output because H (k) is close
to zero in that frequency range. This is also visible in the y(t) plot
below where the cos(πt) component of u(t) has been filtered out.

u(t)
1.5

0.5

-0.5

-1

-1.5
0 10 20 30 40 50 60 70 80 90 100

1.5

1 y(t)
0.5

-0.5

-1

-1.5
0 10 20 30 40 50 60 70 80 90 100

Proof of (130)

We first rewrite (129) as the sum

C = c 0 I + c 1 S + c 2 S 2 + · · · c N −1 S N −1 (132)
ee16b notes spring’17 77

where the matrix S is defined as


 
0 ··· ··· 0 1
 1 0 0 
 
 .. 
S, 0 1 0 . .
 
 .. . . .. .. ..
 
. . .

 . . 
0 ··· 0 1 0

As an illustration, (132) decomposes a 3 × 3 circulant matrix as


       
c0 c2 c1 1 0 0 0 0 1 0 1 0
 c1 c0 c2 = c0 0 1 0 + c1 1 0 0 +c2 0 0 1 .
       
c2 c1 c0 0 0 1 0 1 0 1 0 0
| {z } | {z }
S S2

Next we claim that


~u∗k S = Wk∗~u∗k (133)

where Wk = e jk N . To see this recall that

1 h i
~u∗k = √ 1 Wk∗ · · · (Wk∗ ) N −1
N

and note that multiplication by S gives

1 h ∗ i 1 h ∗ i
~u∗k S = √ Wk · · · (Wk∗ ) N −1 1 = √ Wk · · · (Wk∗ ) N −1 (Wk∗ ) N
N N

where we substituted14 (Wk∗ ) N = 1. Factoring out Wk∗ from each



14
This follows because Wk = e jk N .
entry we get the expression (133). With a recursive application of
(133) we also conclude that

~u∗k St = (Wkt )∗~u∗k .

Then, using (132),

N −1 N −1 √
~u∗k C = ∑ ct~u∗k St = ∑ ct (Wkt )∗~u∗k = NC (k)~u∗k (134)
t =0 t =0

where the last equality follows because


   
c0 c0
N −1 i c1  √ c1
h   
∑ ct (Wkt )∗ Wk∗ · · · (Wk∗ ) N −1  = N ~u∗ 
  
= 1  .. k .. .
. .
  
t =0    
c N −1 c N −1
| {z }
C (k)
78 murat arcak

Finally note from (134) that

~u0∗ ~u0∗
   
 
C (0)
 ~u1∗   ~u1∗ 
√  C (1)
    
~u2∗ ~u2∗
   
C = N .
..
 
.. . ..
    
    
 .   . 
C ( N − 1)
~u∗N −1 ~u∗N −1
| {z } | {z }
F∗ F∗
Multiplying both sides from the right by F and substituting F ∗ F = I
on the right hand side, we obtain (130).

You might also like