Homework 9 - University of California,...

Post on 15-Aug-2020

1 views 0 download

transcript

EECS 16B Designing Information Devices and Systems IISpring 2017 Murat Arcak and Michel Maharbiz Homework 9

This homework is due April 5, 2017, at 17:00.

1. Midterm 2 - Question 1

Redo the midterm!

2. Midterm 2 - Question 2

Redo the midterm!

3. Midterm 2 - Question 3

Redo the midterm!

4. Midterm 2 - Question 4

Redo the midterm!

5. Midterm 2 - Question 5

Redo the midterm!

6. Midterm 2 - Question 6

Redo the midterm!

7. Midterm 2 - Question 7

Redo the midterm!

8. The Moore-Penrose pseudoinverse for “fat” matrices

Say we have a set of linear equations described as A~x =~y. If A is invertible, we know that the solutionis ~x = A−1~y. However, what if A is not a square matrix? In 16A, you saw how this problem could beapproached for tall matrices A where it really wasn’t possible to find a solution that exactly matches allthe measurements. The Linear Least-Squares solution gives us a reasonable answer that asks for the “best”match in terms of reducing the norm of the error vector.

This problem deals with the other case — when the matrix A is short and fat. In this case, there are generallygoing to be lots of possible solutions — so which should we choose? Why? We will walk you throughthe Moore-Penrose Pseudoinverse that generalizes the idea of the matrix inverse and is derived from thesingular value decomposition.

(a) Say you have the following matrix.

A =

[1 1 11 −1 1

]

Calculate the SVD decomposition of A. That is to say, calculate U,Σ,V such that,

A =UΣV T

EECS 16B, Spring 2017, Homework 9 1

What are the dimensions of U,Σ and V ?Note. Do NOT use a computer to calculate the SVD. You may be asked to solve similar questions onyour own in the exam.

(b) Let us think about what the SVD does. Let us look at matrix A acting on some vector ~x to give theresult~y. We have,

A~x =UΣV T~x =~y

Observe that V T~x rotates the vector, Σ scales it and U rotates it again. We will try to "reverse" theseoperations one at a time and then put them together.If U “rotates” the vector

(ΣV T

)~x, what operator can we derive that will undo the rotation?

(c) Derive an matrix that will "unscale", or undo the effect of Σ where it is possible to undo. Recall that Σ

has the same dimensions as A. Ignore any division by zeros (that is to say, let it stay zero).

(d) Derive an operator that would "unrotate" by V T .

(e) Try to use this idea of "unrotating" and "unscaling" to derive an "inverse" (which we will use A† todenote). That is to say,

~x = A†~y

The reason why the word inverse is in quotes (or why this is called a pseudo-inverse) is because we’reignoring the "divisions" by zero.

(f) Use A† to solve for~x in the following systems of equations.[

1 1 11 −1 1

]~x =

[24

]

(g) (Optional) Now we will see why this matrix is a useful proxy for the matrix inverse in such circum-stances. Show that the solution given by the Moore-Penrose Psuedoinverse satisfies the minimalityproperty that if ~x is the psuedo-inverse solution to A~x =~y, then ‖~x‖ ≤ ‖~z‖ for all other vectors~z satis-fying A~z =~y.(Hint: look at the vectors involved in the V basis. Think about the relevant nullspace and how it isconnected to all this.)This minimality property is useful in both control applications (as you will see in the next problem)and in communications applications.

9. SVD for minimum energy controlGiven a practical discrete linear system model~x(t +1) = A~x(t).

Consider applying open loop control

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

to the system to drive it from some initial state ~x0 to ~x f . (for simplicity we considered scaler u(t), but theconclusion of this problem can be readily extended to vector inputs). We know that if A,B are controllableand the dimension is n, then clearly we can get to the desired~x f in n steps. However, suppose that we onlyneed to get there by m > n steps. We now have a lot of flexibility.

Among all controls that guarantees “reachability”, we could ask for a control that gets us to the desired ~x f

using minimal energy. i.e., having minimal

m−1

∑t=0‖u(t)‖2.

EECS 16B, Spring 2017, Homework 9 2

A concrete example such that ∑m−1t=0 ‖u(t)‖2 can be the “energy” of the control inputs is if the input is a

voltage, where voltage2 is power.

(a) Consider the system evolution equations from t = 1 to t =m, obtain an expression of~x(m) as a functionof the initial state~x0 and control inputs.

(b) Write out the above equation in a matrix form, with~u = [u(0),u(1), · · · ,u(m−1)]T .

(c) Now you have obtained a linear equation in the form ~y = C~u, where ~y and C contains your resultsfrom last question. Recall that in the previous problem, you have shown that the solution obtainedby psuedo-inverse (using the SVD) has a nice minimality property. Use this to derive the minimumenergy control inputs~u.

10. Recommendation system

On Saavan’s recommendation, the EE16B TAs hang out all the time outside of work. Every Friday night,we watch movies on Netflix and we have been collecting ratings for all the movies we’ve watched. Asample of this data set is shown below, and gives star ratings (between 1 and 5 stars) for each of themovies we’ve watched. These data are saved in the file data_TAs.csv. Professors Maharbiz and Ar-cak sometimes crash movie night, and when they do we also collect their ratings. These data are saved indata_arcak.json and data_maharbiz.json.

In this problem, we will use the SVD to build a system that will predict ratings for unrated movies basedon a small sample of rated movies. This will allow us to make customized movie recommendations for theprofessors, like Netflix does for its viewers. Use the iPython notebook Recommender_System.ipynb.Note that the first cell loads in the TAs’ ratings for you already.

11. Brain-machine interface

The iPython notebook pca_brain_machine_interface.ipynb will guide you through the process of analyzingbrain machine interface data using principle component analysis (PCA). This will help you to prepare forthe project, where you will need to use PCA as part of a classifier that will allow you to use voice or musicinputs to control your car.

Please complete the notebook by following the instructions given.

EECS 16B, Spring 2017, Homework 9 3

EE 16B Midterm 2, March 21, 2017

Name:

SID #:

Discussion Section and TA:

Lab Section and TA:

Name of left neighbor:

Name of right neighbor:

Important Instructions:

• Show your work. An answer without explanation

is not acceptable and does not guarantee any credit.

• Only the front pages will be scanned and

graded. You can use the back pages as scratch paper.

• Do not remove pages, as this disrupts the scanning.

Instead, cross the parts that you don’t want us to grade.

Problem Points

1 10

2 15

3 10

4 20

5 15

6 15

7 15

Total 100

1

1. (10 points) The thirteenth century Italian mathematician Fibonacci de-scribed the growth of a rabbit population by the recurrence relation:

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

where y(t) denotes the number of rabbits at month t. A sequence generatedby this relation from initial values y(0), y(1) is known as a Fibonacci sequence.

a) (5 points) Bring the recurrence relation above to the state space form usingthe variables x1(t) = y(t) and x2(t) = y(t + 1).

2

b) (5 points) Determine the stability of this system.

3

2. (15 points) Consider the circuit below that consists of a capacitor, aninductor, and a third element with the nonlinear voltage-current characteristic:

i = −v + v3.

C L

iL i

vC v+ +

− −

a) (5 points) Write a state space model of the form

dx1(t)

dt= f1(x1(t), x2(t))

dx2(t)

dt= f2(x1(t), x2(t))

using the states x1(t) = vC(t) and x2(t) = iL(t).

f1(x1, x2) = f2(x1, x2) =

4

b) (5 points) Linearize the state model at the equilibrium x1 = x2 = 0 andspecify the resulting A matrix.

5

c) (5 points) Determine stability based on the linearization.

6

3. (10 points) Consider the discrete-time system

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

where

A =

0 1 00 0 00 0 0

B =

010

.

a) (5 points) Determine if the system is controllable.

7

b) (5 points) Explain whether or not it is possible to move the state vectorfrom �x(0) = 0 to

�x(T ) =

210

.

If your answer is yes, specify the smallest possible time T and an input sequenceu(0), . . . , u(T − 1) to accomplish this task.

8

4. (20 points) Consider the system

�x(t + 1) =

�cos θ − sin θsin θ cos θ

��x(t) +

�01

�u(t)

where θ is a constant.

a) (5 points) For which values of θ is the system controllable?

b) (10 points) Select the coefficients k1, k2 of the state feedback controller

u(t) = k1x1(t) + k2x2(t)

such that the closed-loop eigenvalues are λ1 = λ2 = 0. Your answer should besymbolic and well-defined for the values of θ you specified in part (a).

9

Additional workspace for Problem 4b.

10

c) (5 points) Suppose the state variable x1(t) evolves as depicted below whenno control is applied (u = 0). What is the value of θ?

0 2 4 6 8 10 12 14 16-1

-0.5

0

0.5

1

t

x1(t)

11

5. (15 points) Consider the inverted pendulum below, where p(t) is the positionof the cart, θ(t) is the angle of the pendulum, and u(t) is the input force.

p

u M

m

θ

When linearized about the upright position, the equations of motion are

p(t) = −m

Mg θ(t) +

1

Mu(t)

θ(t) =M + m

M�g θ(t) − 1

M�u(t)

(1)

where M , m, �, g are positive constants.

a) (5 points) Using (1) write the state model for the vector

�x(t) =�p(t) p(t) θ(t) θ(t)

�T.

12

b) (5 points) Suppose we measure only the position; that is, the output isy(t) = x1(t). Determine if the system is observable with this output.

13

c) (5 points) Suppose we measure only the angle; that is, the output is y(t) =x3(t). Determine if the system is observable with this output.

14

6. (15 points) Consider the system

x1(t + 1)x2(t + 1)x3(t + 1)

=

0.9 0 00 1 10 1 0

� �� �A

x1(t)x2(t)x3(t)

, y(t) =

�0 1 0

�� �� �

C

x1(t)x2(t)x3(t)

.

a) (5 points) Select values for �1, �2, �3 in the observer below such that x1(t),x2(t), x3(t) converge to the true state variables �x1(t), �x2(t), �x3(t) respectively.

x1(t + 1)x2(t + 1)x3(t + 1)

=

0.9 0 00 1 10 1 0

x1(t)x2(t)x3(t)

+

�1�2�3

� �� �L

(x2(t) − y(t)).

15

Additional workspace for Problem 6a.

16

b) (5 points) Professor Arcak found a solution to part (a) that guaranteesconvergence of x3(t) to x3(t) in one time step; that is

x3(t) = x3(t) t = 1, 2, 3, . . .

for any initial �x(0) and x(0). Determine his �3 value based on this behavior ofthe observer. Explain your reasoning.

17

c) (5 points) When Professor Arcak solved part (a), he found the convergenceof x1(t) to x1(t) to be rather slow no matter what L he chose. Explain thereason why no choice of L can change the convergence rate of x1(t) to x1(t).

18

7. (15 points) Consider a system with the symmetric form

d

dt

��x1(t)�x2(t)

�=

�F HH F

� ��x1(t)�x2(t)

�+

�GG

��u(t), (2)

where �x1 and �x2 have identical dimensions and, therefore, F and H are squarematrices.

a) (5 points) Define the new variables

�z1 = �x1 + �x2 and �z2 = �x1 − �x2,

and write a state model with respect to these variables:

d

dt

��z1(t)�z2(t)

�=

��z1(t)�z2(t)

�+

u(t).

19

b) (5 points) Show that the system (2) is not controllable.

20

c) (5 points) Write a state model for the circuit below using the inductorcurrents as the variables. Show that the model has the symmetric form (2).

ux1 x2

L L R

21

22

Contributors:

• Siddharth Iyer.

• Ioannis Konstantakopoulos.

• John Maidens.

EECS 16B, Spring 2017, Homework 9 26