Escolar Documentos
Profissional Documentos
Cultura Documentos
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
n
X
! 12
x2j
j=1
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
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
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
y(k)
y(k 1)
x(k + 1) =
..
.
y(k p + 1)
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
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)
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)
..
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
= 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).
+
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
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
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(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
j=1
Alex Lemon
June 23, 2015
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)
..
.
(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)
n
X
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.
(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
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
M = 7
Alex Lemon
June 23, 2015