Você está na página 1de 11

Alex Lemon

EE263: Introduction to Linear Dynamical Systems


Problem Session 1
June 23, 2015
1 Gradient of the norm function
Recall that the gradient of a differentiable function f : Rn R at a point x Rn is
defined to be the vector

f
(x)
x1

f (x) = ... .
f
(x)
xn
The first-order Taylor expansion of f near x is given by
f1 (z) = f (x) + f (x)T (z x).
This function is affine: that is, a linear function plus a constant offset. If z is near x,
then f1 (z) is very near f (z). Find the gradient of the function f (x) = kxk.
Solution (perturbation method):
We have that
f (x + ) = kx + k
p
= (x + )T (x + )
q
= kxk2 + 2xT + kk2
s
2xT + kk2
= kxk 1 +
kxk2
!
Qn1 1
2 n
T
X
(

k)
2x

+
kk
k=0 2
= kxk
n!
kxk2
n=0
T

1
x + o(kk),
= kxk +
kxk
where we have used the power-series expansion
Qn1 1
X

k=0 ( 2 k) n
1+z =
z ,
n!
n=0
which is valid for small z. Thus, we see that
f (x) =

Alex Lemon
June 23, 2015

1
x.
kxk

EE263: Introduction to Linear Dynamical Systems


Problem Session 1: Page 1 of 11

Solution (differentiation method):


We can express f (x) as
f (x) = kxk =

n
X

! 12
x2j

j=1

Thus, we have that


1
f
(x) =
xk
2

n
X
j=1

! 12
x2j

xk

n
X
j=1

!
x2j

1
=
2

n
X

! 12
x2j

(2xk ) =

j=1

xk
.
kxk

Collecting these partial derivatives into a vector, we find that the gradient of f is
f
x1
(x)
kxk
x1
1
.. ..
f (x) = . = . =
x.
kxk
xn
f
(x)
kxk
xn

2 Some standard time-series models


In some contexts, a discrete-time signal is called a time series. The study of time series
predates the extensive study of linear state-space systems, and is used in many fields. Let
u and y be two time series, which we will think of as the input and output, respectively.
(a) The relation (or time-series model)
y(k) = a0 u(k) + a1 u(k 1) + + ar u(k r)
is called a moving-average (MA) model. Since the output at time k is a weighted
average of the previous r inputs, we can think of the output as the average of the
inputs in a moving window. Express this model as a linear dynamical system with
input u, output y, and state

u(k 1)

..
x(k) =
.
.
u(k r)
(b) Another time-series model is
y(k) = u(k) + b1 y(k 1) + + bp y(k p).
This model is called an autoregressive (AR) model, since the current output is a
linear combination of the current input, and some previous values of the output.

Alex Lemon
June 23, 2015

EE263: Introduction to Linear Dynamical Systems


Problem Session 1: Page 2 of 11

Express this model as a linear dynamical system with input u, output y, and state

y(k 1)

..
x(k) =
.
.
y(k p)
(c) A third widely used model is the autoregressive, moving-average (ARMA) model,
which combines the MA and AR models:
y(k) = a0 u(k) + + ar u(k r) + b1 y(k 1) + + bp y(k p).
Express this model as a linear dynamical system with input u and output y (you
can choose the state; there are many possible choices, and not all choices have the
same dimension).
Solution:
(a) The state equation for the MA model is

u(k)
u(k 1)

x(k + 1) =

..

.
u(k r + 1)


u(k 1)
0 0 0 0
1

1 0 0 0 u(k 2) 0


..
= .. .. . . .. ..
+ .. u(k)
.
.
. .
. . .
u(k r + 1)
0 0 1 0
0
u(k r)

0 0 0 0
1
1 0 0 0
0

= .. .. . . .. .. x(k) + .. u(k).
. .
.
. . .
0 0 1 0
0
The output equation is
y(k) = a0 u(k) + a1 u(k 1) + + ar u(k r)

u(k 1)


 
..
= a1 ar
+ a0 u(k)
.
u(k r)


 
= a1 ar x(k) + a0 u(k).

Alex Lemon
June 23, 2015

EE263: Introduction to Linear Dynamical Systems


Problem Session 1: Page 3 of 11

(b) The state equation for the AR model is

y(k)
y(k 1)

x(k + 1) =

..

.
y(k p + 1)

u(k) + b1 y(k 1) + + bp y(k p)

y(k 1)

..

.
y(k p + 1)


b1 bp1 bp
y(k 1)
1
1 0

.
0
..

0
= .. . .
+ . u(k)
..
..
.
.
.
. y(k p + 1) ..
0 1
0
y(k p)
0

b1 bp1 bp
1
0

1 0
0

= .. . .
..
.. x(k) + .. u(k).
.
.
.
.
.
0
0 1
0
The output equation is
y(k) = u(k) + b1 y(k 1) + + bp y(k p)

y(k 1)


 
..
= b1 bp
+ 1 u(k)
.
y(k p)


 
= b1 bp x(k) + 1 u(k).
(c) Choose the state

u(k 1)
..

u(k r)
x(k) =
.
y(k 1)

..

.
y(k p)

Alex Lemon
June 23, 2015

EE263: Introduction to Linear Dynamical Systems


Problem Session 1: Page 4 of 11

Then, the state equation for the ARMA model is

u(k)
u(k 1)

..

u(k r + 1)
x(k + 1) =

y(k)

y(k 1)

..

.
y(k p + 1)

u(k)

u(k 1)

..

u(k

r
+
1)

= a0 u(k) + a1 u(k 1) + + ar1 u(k r + 1) + ar u(k r)

+ b1 y(k 1) + + bp1 y(k p + 1) + bp y(k p)

y(k 1)

..
y(k p + 1)

0 0
0 0 0
0
u(k 1)
1
.
1 0

0
0 0 0
0
..
.

.
..
.. .. . .
..
..
. ...

.
. .
.
. u(k r + 1) ..
.
.

0 0 0
0 u(k r) 0
0 1
=
+ u(k)

a1 ar1 ar b1 bp1 bp y(k 1) a0

..
0 1 0
0
0 0
0
.
. .

..
.. .. . .
..
..
..
..
.
y(k p + 1) ..
.
. .
.
.
y(k p)
0 0
0 0 1
0
0


0 0
0 0 0
0
1
1 0

0
0
0

0
0
.
.
..
.. .. . .
..
..
. ...

.
.
.
. .
.
.
.
.


0 0 0
0
0 1
0
=
x(k) + u(k).
a1 ar1 ar b1 bp1 bp
a0


0 1 0
0
0 0
0
. .

.
.
.
.
.
.
.
..
..
..
..
.. ..
..
..
..
0 0
0 0 1
0
0
The output equation is
y(k) = a0 u(k) + a1 u(k 1) + + ar u(k r) + b1 y(k 1) + + bp y(k p)

Alex Lemon
June 23, 2015

EE263: Introduction to Linear Dynamical Systems


Problem Session 1: Page 5 of 11


= a1 ar b 1


= a1 ar b 1

u(k 1)
..


u(k r)  
bp
+ a0 u(k)
y(k 1)

..

.
y(k p)

 
bp x(k) + a0 u(k).

3 Some linear functions associated with a convolution system


Suppose that u and y are discrete-time scalar signals related via convolution:
y(t) =

+
X

h(t )u( ),

t Z,

where (h(t) : t Z) is a known discrete-time scalar signal. You may assume that the
system is causal: that is, h(t) = 0 for all t < 0.
(a) Suppose u(t) = 0 for all t < 0. Define the vectors

u(0)
y(0)
u(1)
y(1)

u = ..
and
y = .. .
.
.
u(T )
y(T )
Thus, u and y are the first T +1 values of the input and output signals, respectively.
Find the matrix G R(T +1)(T +1) such that y = G
u. The matrix G describes the
linear mapping from (a segment of) the input sequence to (a segment of) the
output sequence; G is called the input/output or Toeplitz matrix of size T + 1
associated with the convolution system.
(b) Now suppose that u(t) = 0 for all t < 0 and t > T . Define the vectors

u(T )
y(T )
u(T 1)
y(T + 1)

u =
and
y =

.
..
..

.
.
u(0)
y(2T )
Thus, u is the input to the system, and y is (a segment of) the future output of
the system. Find the matrix H R(T +1)(T +1) such that y = H u. The matrix H
describes the linear mapping from the input sequence to (a segment of) the future
output sequence; H is called the Hankel matrix of size T + 1 associated with the
convolution system.

Alex Lemon
June 23, 2015

EE263: Introduction to Linear Dynamical Systems


Problem Session 1: Page 6 of 11

Solution:
Since the system is causal, our expression for y(t) simplifies to
y(t) =

t
X

h(t )u( ).

(a) If u(t) = 0 for all t < 0, then our expression for y(t) simplifies to
y(t) =

t
X

h(t )u( ).

=0

Note that Gij gives the effect of the input u(j 1) on the output y(i 1). Making the
change of variables t = i 1 and = j 1 in our expression for y(t) gives
y(i 1) =

i
X

h(i j)u(j 1).

j=1

Based on our characterization of Gij as the effect of the input u(j 1) on the output
y(i 1), we see that
(
h(i j) 1 j i,
Gij =
0
otherwise.
More concretely, G has the form

y(0)
y(1)

G = y(2)
..
.
y(T )

u(0)

u(1)

u(2)

u(T )

h(0)
h(1)
h(2)
..
.

0
h(0)
h(1)
..
.

0
0
h(0)
..
.

..
.

0
0
0
..
.

h(T ) h(T 1) h(T 2)

h(0)

(b) If u(t) = 0 for all t < 0 and t > T , then our expression for y(t) simplifies to
min(t,T )

y(t) =

h(t )u( ).

=0

Since we are only concerned with y(t) for t T , the upper limit of summation is
min(t, T ) = T . Note that Hij gives the effect of the input u(T j + 1) on the output
y(T + i 1). Making the change of variables t = T + i 1 and = T j + 1 in our
expression for y(t) gives
y(T + i 1) =

T +1
X

h(i + j 2)u(T j + 1).

j=1

Alex Lemon
June 23, 2015

EE263: Introduction to Linear Dynamical Systems


Problem Session 1: Page 7 of 11

Based on our characterization of Hij as the effect of the input u(T j + 1) on the
output y(T + i 1), we see that
Hij = h(i + j 2)
More concretely, H has the form
u(T )
y(T )
y(T +1)

H=

y(T +2)

..
.
y(2T )

u(T 1)

u(T 2)

u(0)

h(T )
h(T + 1)
h(T + 2)
..
...
.
h(T ) h(T + 1) h(T + 2)
h(2T )
h(0)
h(1)
h(2)
..
.

h(1)
h(2)
h(3)
..
.

h(2)
h(3)
h(4)
..
.

4 Counting paths in an undirected graph


Consider an undirected graph with n nodes, and no self loops. Let A Rnn be the
node-adjacency matrix, which is defined such that
(
1 there is an edge between nodes i and j,
Aij =
0 otherwise.
Note that A = AT because the graph is undirected, and Aii = 0 since there are no self
loops. Give an interpretation of (Ap )ij (that is the (i, j)-entry of Ap ) for p N.
Solution:
Let SL (i, j) denote the set of paths of length L between node i and node j:
SL (i, j) = {(k1 = i, k2 , . . . , kL1 , kL = j) NLn | Ak` k`+1 = 1 for all ` = 1, . . . , L 1}.
We claim that
(Ap )ij = |Sp+1 (i, j)|
for all i, j Nn and p N. First, we introduce some notation. Given a finite sequence of
nodes (k1 , . . . , kL ) and a node kL+1 , we define
(k1 , . . . , kL ) + kL+1 = (k1 , . . . , kL , kL+1 ).
(Thus, + denotes the operation of appending a symbol to a finite sequence of symbols.)
Similarly, given a set S of finite sequences of symbols, we define
S + j = {s + j | s S}.
Finally, we define
N (i) = {j Nn | there is an edge between nodes i and j} = {j Nn | Aij = 1}.
Alex Lemon
June 23, 2015

EE263: Introduction to Linear Dynamical Systems


Problem Session 1: Page 8 of 11

(The set N (i) is called the neighborhood of node i.) First, we prove the statement when
p = 1:
(A1 )ij = |S2 (i, j)|.
Note that |S2 (i, j)| = 1 if (i, j) is a path in the graph (that is, there is an edge between
nodes i and j; or, equivalently, Aij = 1), and |S2 (i, j)| = 0 otherwise (that is, there is not
an edge between nodes i and j; or, equivalently, Aij = 0). In either case, we have that
|S2 (i, j)| = Aij = (A1 )ij . Now suppose that (Ap )ij = |Sp+1 (i, j)| for some p N. We can
partition Sp+2 (i, j) based on the penultimate node:
G
Sp+2 (i, j) =
(Sp+1 (i, k) + j).
kN (j)

Since the size of a disjoint union is equal to the sum of the sizes of the sets forming the
union, we have that
X
X
|Sp+2 (i, j)| =
|Sp+1 (i, k) + j| =
|Sp+1 (i, k)|.
kN (j)

kN (j)

Because Akj = 1 for k N (j), and Akj = 0 for k


/ N (j), we have that
|Sp+2 (i, j)| =

n
X

Akj |Sp+1 (i, k)|.

k=1

Using the induction hypothesis, we have that |Sp+1 (i, k)| = (Ap )ik , and hence that
n
n
X
X
p
|Sp+2 (i, j)| =
(A )ik Akj =
(Ap A)ij = (Ap+1 )ij .
k=1

k=1

By induction, this proves that our interpretation of (Ap )ij is correct for all p N.

5 Memory of a linear, time-invariant system


Suppose an input signal (ut : t Z), and an output signal (yt : t Z) are related by a
convolution operator:
M
X
h ut ,
yt =
=1

where h = (h1 , . . . , hM ) are the impulse-response coefficients of the convolution system.


(Convolution systems are also called linear, time-invariant systems.) If hM 6= 0, then
M is called the memory of the system. You are given the input and output signals for
t = 1, . . . , T :
u1 , . . . , uT
and
y1 , . . . , yT .
However, you do not know ut or yt for y < 1 or t > T , and you do not know the impulse
response, h.
(a) Explain how to find the smallest value of M , and a corresponding impulse response
(ht : t = 1, . . . , M ) that is consistent with the given data. You may assume that
T > 2M .
Alex Lemon
June 23, 2015

EE263: Introduction to Linear Dynamical Systems


Problem Session 1: Page 9 of 11

(b) Apply your method to the data in lti_memory_data.m. Report the value of M
that you find.
Hint. The function toeplitz may be useful.
Solution:
(a) We have data for the observations
yt =

M
X

h ut ,

t = M + 1, . . . , T.

=1

We can collect the data into a single matrix-vector equation:



yM +1
uM uM 1
u1
h1

yM +2 uM +1 uM
u
2 h2


.. = ..
..
.. .. .
..
. .
.
.
. .
yT
uT 1 uT 2 uT m
hM
A model that has memory M is consistent with the observed data (ut : t = 1, . . . , T )
and (yt : t = 1, . . . , T ) if the system given above has a solution (ht : t = 1, . . . , M ).
Then, (ht : t = 1, . . . , M ) is an impulse response that is consistent with the data. In
order to find the smallest value of M , we simply try M = 1, 2, . . ., and take the smallest
value of M that is consistent with the data.
(b) The smallest memory consistent with the data is M = 7. The script used to perform
the analysis is given below.
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% clean up the workspace , and load the data
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear all ; close all ; clc
lti_memory_data ;
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% find the smallest value of M consistent with the data
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
for M = 1:( T -1)
yM = y (( M +1) : T ) ;
UM = toeplitz ( u ( M :( T -1) ) , u ( M :( -1) :1) ) ;
if rank ( UM ) == rank ([ UM yM ])
break ;
end
end
hM = UM \ yM ;
fprintf ( 'M = % d \ n ' , M ) ;
Output:
Alex Lemon
June 23, 2015

EE263: Introduction to Linear Dynamical Systems


Problem Session 1: Page 10 of 11

M = 7


Alex Lemon
June 23, 2015

EE263: Introduction to Linear Dynamical Systems


Problem Session 1: Page 11 of 11

Você também pode gostar