Sunteți pe pagina 1din 14

EE263, Autumn 2014-15 Prof. S.

Lall

EE263 Homework 3 solutions


3.29 Transmit powers in a wireless network. We consider a network of n transmitter/receiver
pairs. Transmitter i transmits at power level pi , which must satisfy 0 ≤ pi ≤ P max ,
where P max is a given maximum transmitter power (which is the same for all transmit-
ters). The path gain from transmitter j to receiver i is Gij (which are all nonnegative,
and Gii are positive). The signal power at receiver i is given by si = Gii pi . The noise
plus interference power at receiver i is given by
X
qi = σ + Gij pj
j6=i

where σ > 0 is the self-noise power of the receivers (assumed to be the same for all
receivers). The signal to interference plus noise ratio (SINR) at receiver i is defined as
Si = si /qi .

(a) Explain how to determine if there is a power allocation (i.e., a vector p) that
satisfies the constraints 0 ≤ pi ≤ P max and achieves Si = S target for i = 1, . . . , n,
where S target is a (positive) target value of SINR. Explain how to find such a
power allocation when it exists. You can assume that a matrix appearing in your
analysis is full rank, but please make this assumption explicit.
(b) Among the SINR target values S target = 2, 2.1, 2.2, . . . , 3.9, 4, find the largest for
which there is a power allocation that satisfies the constraints 0 ≤ pi ≤ P max and
achieves Si = S target for i = 1, . . . , n, for the problem data
 
1 .2 .1
G =  .1 2 .1  , σ = 0.01, P max = 0.1.
 

.3 .1 3

Remarks.

• This problem is related to, but independent of, homework exercise 2.1; for exam-
ple, there is no time or power update algorithm in this problem. (And no, you
cannot solve this problem by simply running the algorithm from exercise 2.1.)
• Yes, this problem includes constraints on p (i.e., that its entries are nonnegative
and no more than P max), which we have not covered in EE263. Still, you can
solve it (with material we have covered).
• If you solve this problem using methods that are more advanced or complicated
than needed, we will deduct points.

Solution.

1
(a) We want to find p such that si /qi = S target for each i. We restate this as si =
S target qi for each i. This occurs if and only if
 
X
Gii pi = S target σ + Gij pj 
i6=j

which we write as X
Gii pi − S target Gij pj = S target σ.
i6=j

This is a set of n linear equations in n variables or unknowns (i.e., p). Defining


Hii = Gii , and Hij = −S target Gij for i 6= j, and gi = S target σ for i = 1, . . . , n, we
can write the equations as
Hp = g.
We will assume that H is full rank (as the problem statement hints). In this case,
there is only one value of p that satisfies these equations, given by p = H −1 g. If
this p satisfies 0 ≤ pi ≤ P max , then p is a valid power allocation. If not, then no
such p exists.
(b) By plotting the powers versus S target , or by direct observation, we find that the
largest achievable SINR value from among those considered is S ⋆ = 3.8, with
corresponding power allocation p⋆ = (0.0948, 0.0474, 0.0547). You can check that
each H matrix is indeed invertible, so Hp = g has a unique solution. The only
thing we need to check is that the entries of p are within the bounds 0 ≤ pi ≤ P max .
The code and resulting plot is below. We see from the plot that, of the values
considered, S target ≤ 3.8 has a feasible allocation, while values above 3.8 are
infeasible, due to p1 being too large.

0.11
p1
0.1 p2
p
3
0.09
Pmax
0.08
Power allocation

0.07

0.06

0.05

0.04

0.03

0.02

0.01
2 2.2 2.4 2.6 2.8 3 3.2 3.4 3.6 3.8 4
Starget

2
n = 3;
G = [1 .2 .1; .1 2 .1; .3 .1 3];

% H = G_d - S_target*G_o
G_d = diag(diag(G));
G_o = G - diag(diag(G));

S_target = 2:.1:4;
k = length(S_target);

sigma = 0.01;
p_max = 0.1*ones(n,1);

feasible = false(k,1);
ps = zeros(n,k);

for i = 1:k
g = S_target(i)*sigma*ones(n,1);
H = G_d - S_target(i)*G_o;
ps(:,i) = H\g;
feasible(i) = all(0 <= ps(:,i)) && all(ps(:,i) <= p_max);
end

i = find(feasible,1,’last’);
p_star = ps(:,i);
S_star = S_target(i);

plot(S_target’,ps’)
hold on
plot(S_target’,0.1*ones(k,1),’k--’)
legend(’p_1’,’p_2’,’p_3’,’P^{max}’,’Location’,’NorthWest’)
ylabel(’Power allocation’)
xlabel(’S^{target}’)

3.30 Checking some range and nullspace conditions. Explain how to determine whether or
not the following statements hold:

(a) R(A) = R(B).


(b) R(A) ⊥ R(B).
(c) R(A) ∩ R(B) = {0}.
(d) R(C) ⊆ N (B).

The matrices have dimensions A ∈ Rm×n , B ∈ Rm×p , C ∈ Rp×m.

3
Your answer can involve standard matrix operations on the matrices above, such as
addition, multiplication, transposition, concatenation (i.e., building block matrices),
and inversion, as well as a function Rank(X), that gives the rank of a matrix X, and
det(X), which gives the determinant of a (square) matrix X.
For example, you might assert that (a) holds if and only if Rank([A B]) = m. (This
is not correct; it’s just an example of what your answer might look like.)
You do not need to give a proof or long justification that your conditions are correct;
a short one or two sentence explanation for each statement is fine. Points will be
deducted from correct answers that are substantially longer than they need to be, or
are confusing (to us).
Solution.

(a) R(A) = R(B) if and only if Rank([A B]) = Rank(A) = Rank(B).


First assume that R(A) = R(B) holds. In general we have R([A B]) = R(A) +
R(B). Since R(A) = R(B), we have since R([A B]) = R(A) = R(B) (this is
equality of three subspaces of Rm ). Taking the dimension of these three (identical)
subspaces, we conclude Rank([A B]) = Rank(A) = Rank(B).
To show the converse, suppose that Rank([A B]) = Rank(A) = Rank(B). We
always have R([A B]) ⊇ R(A) (and same for B). From the assumption, these
two subspaces have the same dimension, and we conclude they are equal, i.e.,
R([A B]) = R(A). The same holds for B, and we conclude that R(A) = R(B).
(b) R(A) ⊥ R(B) if and only if AT B = 0.
First note that R(A) ⊥ R(B) means that for any u and any v, we have (Au) ⊥
(Bv). This is equivalent to saying (Au)T (Bv) = uT (AT B)v = 0 for any u and v,
which occurs if and only if AT B = 0. Recall that this last statement follows from
the fact that if uT Cv = 0 for all u and v, then, in particular, cij = eTi Cej = 0 for
all i, j.
(c) R(A) ∩ R(B) = {0} if and only if Rank([A B]) = Rank(A) + Rank(B).
It will be easier to see the above equivalence if we have an orthonormal basis for
R(A) and for R(B). Thus, let QA and QB be matrices (coming from, say, a QR
factorization) whose columns form a basis for R(A) and R(B), respectively. Note
that the ranges of A and QA are the same, and so are their ranks. The same is
true for B and QB . Also, note that Rank([A B]) = Rank([QA QB ]).
With this set up, we can proceed. Note that R(QA ) ∩ R(QB ) = {0} if and only if
QA x = QB y is only solved when QA x = 0 = QB y. Since the columns of QA and
QB form independent sets, this happens if and only if x = 0 and y = 0. If we let
z = −y, we can rewrite this statement as
" #
h i x
QA QB =0
z

4
if and only if x = 0 and z = 0, which is the same as saying that the columns of
[QA QB ] are linearly independent, or [QA QB ] has full rank. That is,

Rank([QA QB ]) = Rank(QA ) + Rank(QB ).

(Each of these matrices is full rank, so the rank is just the number of columns.)
Now, we can finally conclude that R(A) ∩ R(B) = R(QA ) ∩ R(QB ) = {0} if and
only if

Rank([A B]) = Rank([QA QB ]) = Rank(QA )+Rank(QB ) = Rank(A)+Rank(B).

(d) R(C) ⊆ N (B) if and only if BC = 0.


Stating R(C) ⊆ N (B) is equivalent to stating that for any u, Cu ∈ N (B). This,
in turn, is equivalent to B(Cu) = 0 for any u, which occurs if and only if BC = 0.

4.2 Orthogonal matrices.

(a) Show that if U and V are orthogonal, then so is UV .


(b) Show that if U is orthogonal, then so is U −1 .
(c) Suppose that U ∈ R2×2 is orthogonal. Show that U is either a rotation or a
reflection. Make clear how you decide whether a given orthogonal U is a rotation
or reflection.

Solution.

(a) To prove that UV is orthogonal we have to show that (UV )T (UV ) = I given
U T U = I and V T V = I. We have
(UV )T (UV ) = V T U T UV
= V TV (since U T U = I)
= I (since V T V = I)

and we are done.


(b) Since U is square and orthogonal we have U −1 = U T and therefore by taking
inverses of both sides U = (U T )−1 or equivalently U = (U −1 )T (the inverse and
transpose operations commute.) But U T U = I and by substitution U −1 (U −1 )T =
I. Since U −1 is square this also implies that (U −1 )T U −1 = I so U −1 is orthogonal.
" #
a b
(c) Suppose that U = ∈ R2×2 is orthogonal. This is true if and only if
c d
• columns of U are of unit length, i.e., a2 + c2 = 1 and b2 + d2 = 1,
• columns of U are orthogonal, i.e., ab + cd = 0.

5
Since a2 + c2 = 1 we can take a and c as the cosine and sine of an angle α
respectively, i.e., a = cos α and c = sin α. For a similar reason, we can take
b = sin β and d = cos β. Now ab + cd = 0 becomes

cos α sin β + sin α cos β = 0

or
sin(α + β) = 0.
The sine of an angle is zero if and only if the angle is an integer multiple of π. So
α + β = kπ or β = kπ − α with k ∈ Z. Therefore
" #
cos α sin(kπ − α)
U= .
sin α cos(kπ − α)

Now two things can happen:


• k is even so sin(kπ − α) = − sin α and cos(kπ − α) = cos α, and therefore
" #
cos α − sin α
U= .
sin α cos α

Clearly, from the lecture notes, this represents a rotation. Note that in this
case det U = cos2 α + sin2 α = 1.
• k is odd so sin(kπ − α) = sin α and cos(kπ − α) = − cos α, and therefore
" #
cos α sin α
U= .
sin α − cos α

From the lecture notes, this represents a reflection. The determinant in this
case is det U = − cos2 α − sin2 α = −1.
Therefore we have shown that any orthogonal matrix in R2×2 is either a rotation
or reflection whether its determinant is +1 or −1 respectively.

4.5 Sensor integrity monitor. A suite of m sensors yields measurement y ∈ Rm of some


vector of parameters x ∈ Rn . When the system is operating normally (which we hope
is almost always the case) we have y = Ax, where m > n. If the system or sensors
fail, or become faulty, then we no longer have the relation y = Ax. We can exploit the
redundancy in our measurements to help us identify whether such a fault has occured.
We’ll call a measurement y consistent if it has the form Ax for some x ∈ Rn . If the
system is operating normally then our measurement will, of course, be consistent. If
the system becomes faulty, we hope that the resulting measurement y will become
inconsistent, i.e., not consistent. (If we are really unlucky, the system will fail in such
a way that y is still consistent. Then we’re out of luck.) A matrix B ∈ Rk×m is called
an integrity monitor if the following holds:

6
• By = 0 for any y which is consistent.
• By 6= 0 for any y which is inconsistent.

If we find such a matrix B, we can quickly check whether y is consistent; we can send
an alarm if By 6= 0. Note that the first requirement says that every consistent y does
not trip the alarm; the second requirement states that every inconsistent y does trip
the alarm. Finally, the problem. Find an integrity monitor B for the matrix
 
1 2 1
1 −1 −2
 
 
 
A= 
 −2 1 3 .


 1 −1 −2 

1 1 0

Your B should have the smallest k (i.e., number of rows) as possible. As usual, you
have to explain what you’re doing, as well as giving us your explicit matrix B. You
must also verify that the matrix you choose satisfies the requirements. Hints:

• You might find one or more of the matlab commands orth, null, or qr useful.
Then again, you might not; there are many ways to find such a B.
• When checking that your B works, don’t expect to have By exactly zero for a
consistent y; because of roundoff errors in computer arithmetic, it will be really,
really small. That’s OK.
• Be very careful typing in the matrix A. It’s not just a random matrix.

Solution.
The key challenge in this problem is to restate everything in common linear algebra
and matrix terms. We need to find B ∈ Rk×m such that the following hold:

• By = 0 for any consistent y


• By 6= 0 for any inconsistent y

Let’s analyze the conditions, starting with the first one. The set of consistent mea-
surements is exactly equal to the range of the matrix A; so say that By = 0 for every
consistent y is the same as saying R(A) ⊆ N (B), i.e., every element in the range of
A is also in the nullspace of B. In terms of matrices, the first condition means that
for every x, we have BAx = 0. That’s true if and only if BA = 0. (Recall these
are matrices, so we can have BA = 0 without A = 0 or B = 0.) We now consider
the second condition. To say that every inconsistent y has By 6= 0 is equivalent to
saying that whenever By = 0, we have y is consistent. This is the same as saying
N (B) ⊆ R(A). Putting this together with the first condition, we get a really simple
condition: N (B) = R(A). In other words, we need to find a matrix B whose nullspace
is exactly equal to the range of A. Now to find such a B with smallest possible num-
ber of rows, we need B to be full rank. Its rank must be m minus the dimension of

7
the range of A, i.e., m − Rank(A). Now that we know what we’re looking for, there
are several ways to find such a B, given A. Note that whatever method we end up
using we can check that we’ve got a solution by checking that BA = 0 and B is full
rank. One method relies on the fact from lectures that for any matrix C, N (C) and
R(C T ) are orthogonal complements. It follows that N (B) and R(B T ) are orthogonal
complements, and so are R(A) and N (AT ). We require that N (B) = R(A), so this
means their orthogonal complements are equal, i.e., R(B T ) = N (AT ). In matlab, we
can compute a basis for the nullspace of AT using the command null. (In fact null
gives us an orthonormal basis for the nullspace, but for this problem all we care about
is that we get a basis for the nullspace.) This approach can be implemented with the
simple matlab code:

A = [ 1 2 1 ; 1 -1 -2; -2 1 3 ; 1 -1 -2; 1 1 0]; B = null(A’)’;


B*A
rank(B)

The matrix BA does turn out to be zero for all practical purposes; the entries are
very, very small, but nonzero because of roundoff error in computer arithmetic. One
subtlety you may or may not have noticed is that A is not full rank; it has rank 2. In
fact, its third column is equal to its second column minus its first column. That’s why
we end with k = 3, and not 2, as you might have expected. Another way to find such
a B uses the full QR factorization of A. If we have QR factorization
" #
R1
A = [Q1 Q2 ] ,
0

where [Q1 Q2 ] is orthogonal and R1 is upper triangular and invertible, then the columns
of Q1 are an orthonormal basis for the range of A, and the columns of Q2 are an
orthonormal basis for the orthogonal complement. Therefore we can take B = QT2 .
This approach can be carried out in matlab via

[Q,R]=qr(A);
Q2 = Q(:,[3,4,5]); % get the last three columns of Q
B = Q2’;
B*A rank(B)

Two common errors involved the size of B. In each case, B satisfies BA = 0, so


whenever y is consistent, we have By = 0. The first error was to have a B that is
too small, i.e., has fewer than 3 rows. Such a B doesn’t satisfy the second condition;
there are inconsistent y’s with By = 0. Therefore B’s with fewer than 3 rows aren’t
integrity monitors. The opposite error, of having B with more than 3 rows, isn’t quite
so bad. In this case, your B doesn’t have the minimal number of rows, but it is a real
integrity monitor.

8
5.1 Least-squares residuals. Suppose A is skinny and full-rank. Let xls be the least-squares
approximate solution of Ax = y, and let yls = Axls . Show that the residual vector
r = y − yls satisfies
krk2 = kyk2 − kyls k2 .
Also, give a brief geometric interpretation of this equality (just a couple of sentences,
and maybe a conceptual drawing).
Solution.
Let us first show that r ⊥ yls . Since yls = Axls = AA† y = A(AT A)−1 AT y

yls T r = yls T (y − yls ) = yls T y − yls T yls


= y T A(AT A)−1 AT y − y T A(AT A)−1 AT A(AT A)−1 AT y
= y T A(AT A)−1 AT y − y T A(AT A)−1 (AT A)(AT A)−1 AT y
= y T A(AT A)−1 AT y − y T A(AT A)−1 AT y
= 0.
Thus, kyk2 = kyls + rk2 = (yls + r)T (yls + r) = kyls k2 + 2yls T r + krk2 = kyls k2 + krk2 .
Therefore krk2 = kyk2 − kyls k2 .

9
y
✂❊❊
✂ ❊
✂ ❊ −→ By Pythagoras’ theorem, kyk2 = kyls k2 + krk2
✂ ❊
✂ ❊
✂ ❊
✂ ❊
✂ ❊ krk
✂ ❊ R(A)
✂ ❊
kyk ✂ ❊
✂ ❊
✂ ❊
✂ ✏✏❊
✂ ❊ ❊
✂ ✏ ✏❊ ✏yls = Axls

✂ ✏✏✏
✂✏✏ ky ls k
0

6.5 Image reconstruction from line integrals. In this problem we explore a simple version
of a tomography problem. We consider a square region, which we divide into an n × n
array of square pixels, as shown below.

x1 xn+1

x2

xn x2n xn2

The pixels are indexed column first, by a single index i ranging from 1 to n2 , as shown
above. We are interested in some physical property such as density (say) which varies

10
over the region. To simplify things, we’ll assume that the density is constant inside
2
each pixel, and we denote by xi the density in pixel i, i = 1, . . . , n2 . Thus, x ∈ Rn is
a vector that describes the density across the rectangular array of pixels. The problem
is to estimate the vector of densities x, from a set of sensor measurements that we now
describe. Each sensor measurement is a line integral of the density over a line L. In
addition, each measurement is corrupted by a (small) noise term. In other words, the
sensor measurement for line L is given by
n2
X
li xi + v,
i=1

where li is the length of the intersection of line L with pixel i (or zero if they don’t
intersect), and v is a (small) measurement noise. This is illustrated below for a problem
with n = 3. In this example, we have l1 = l6 = l8 = l9 = 0.

line L
x1 x4 l7

l4
x2 x5 x8
l5
l2
x3 x6 x9
l3

Now suppose we have N line integral measurements, associated with lines L1 , . . . , LN .


From these measurements, we want to estimate the vector of densities x. The lines are
characterized by the intersection lengths

lij , i = 1, . . . , n2 , j = 1, . . . , N,

where lij gives the length of the intersection of line Lj with pixel i. Then, the whole
set of measurements forms a vector y ∈ RN whose elements are given by
n 2
X
yj = lij xi + vj , j = 1, . . . , N.
i=1

And now the problem: you will reconstruct the pixel densities x from the line integral
measurements y. The class webpage contains the M-file tomo_data.m, which you
should download and run in matlab. It creates the following variables:

11
• N, the number of measurements (N),
• n_pixels, the side length in pixels of the square region (n),
• y, a vector with the line integrals yj , j = 1, . . . , N,
• lines_d, a vector containing the displacement dj , j = 1, . . . , N, (distance from
the center of the region in pixels lengths) of each line, and
• lines_theta, a vector containing the angles θj , j = 1, . . . , N, of each line.

The file tmeasure.m, on the same webpage, shows how the measurements were com-
puted, in case you’re curious. You should take a look, but you don’t need to understand
it to solve the problem. We also provide the function line_pixel_length.m on the
webpage, which you do need to use in order to solve the problem. This function com-
putes the pixel intersection lengths for a given line. That is, given dj and θj (and the
side length n), line_pixel_length.m returns a n × n matrix, whose i, jth element
corresponds to the intersection length for pixel i, j on the image. Use this information
to find x, and display it as an image (of n by n pixels). You’ll know you have it right.
Matlab hints: Here are a few functions that you’ll find useful to display an image:

• A=reshape(v,n,m), converts the vector v (which must have n*m elements) into
an n × m matrix (the first column of A is the first n elements of v, etc.),
• imagesc(A), displays the matrix A as an image, scaled so that its lowest value is
black and its highest value is white,
• colormap gray, changes matlab’s image display mode to grayscaled (you’ll want
to do this to view the pixel patch),
• axis image, redefines the axes of a plot to make the pixels square.

Note: While irrelevant to your solution, this is actually a simple version of tomography,
best known for its application in medical imaging as the CAT scan. If an x-ray gets
attenuated at rate xi in pixel i (a little piece of a cross-section of your body), the j-th
measurement is 2
n
e−xi lij ,
Y
zj =
i=1

with the lij as before. Now define yj = − log zj , and we get

n2
X
yj = xi lij .
i=1

Solution.
The first thing to do is to restate the problem in the familiar form y = Ax + v. Here,
2
y ∈ RN is the measurement (given), x ∈ Rn is the physical quantity we are interested
2
in, A ∈ RN ×n is the relation between them, and v ∈ RN is the noise, or measurement

12
error (unknown, and we’ll not worry about it). So we need to find the elements of A
. . . how do we do that?
n2 n2
X X
Comparing y = Ax, i.e., yj = Aji xi with our model yj = lij xi + vj
i=1 i=1

it is clear that Aji = lij , j = 1 . . . N, i = 1 . . . n2 . We have thus determined a


standard linear model that we want to “invert” to find x. On running tomo_data.m,
we find that n = 30 and N = 1225, so N > n2 , i.e., we have more rows than columns –
a skinny matrix. If A is full-rank the problem is overdetermined. We can find a unique
(but not exact) solution xls – the least-squares solution that minimizes kAx − yk –
which, due to its noise-reducing properties, provides a good estimate of x (it is the best
linear unbiased estimate). So here’s what we do: we construct A element for element
by finding the length of the intersection of each line with each pixel. That’s done using
the function line_pixel_length.m provided. A turns out to be full-rank (rank(A)
returns 64), so we can compute a unique xls . We go ahead and solve the least-squares
problem, and then display the result.
Here comes a translation of the above paragraph into matlab code:

tomodata

A=zeros(N,n_pixels^2);
for i=1:N
L=line_pixel_length(lines_d(i),lines_theta(i),n_pixels);
A(i,:)=L(:)’;
end

x_ls=A\y;
X_ls=zeros(n_pixels,n_pixels);
X_ls(:)=x_ls;

figure(1)
colormap gray
imagesc(X_ls)
axis image

And here’s the end result, the reconstructed image

13
5

10

15

20

25

30
5 10 15 20 25 30

14

S-ar putea să vă placă și