



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
В данном тексте представлены различные символы и цифры, непонятное содержание. Может содержать ссылки на коды или специфические знаки для конкретных дисциплин.
Typology: Study notes
1 / 7
This page cannot be seen from the preview
Don't miss anything!
David Arnold
Fall 1996
Abstract In this activity you will use Matlab to project a set of vectors onto a single vector. Prerequisites. Inner product (dot product) and orthogonal vectors.
1 The Inner Product
We begin with the de nition of the inner product.
De nition 1 Let u and v be vectors from Rn. The inner product (dot prod- uct) of vectors u and v is de ned by
u ¢ v = uT^ v
Example 2 If u =
and v =
, then
u ¢ v = uT^ v
=
Check this result in Matlab.
u=[1;7]
u =
1 7
v=[-4;2]
v =
2
u*v
ans =
10
If u, v and w are vectors from Rn^ and c is any real number, then it is not di¢cult to show that each of the following properties are true:
² u ¢ v = v ¢ u
² u ¢ (v + w) = u ¢ v + u ¢ w
² (cu) ¢ v = u ¢ (cv) = c(u ¢ v)
² u ¢ u ¸ 0 and u ¢ u = 0 if and only if u = 0.
Finally, orthogonal (perpendicular) vectors are de ned as follows.
De nition 3 Let u and v be vectors from Rn. Vectors u and v are orthogonal if and only if u ¢ v = 0.
Figure 1 shows the projection of vector u onto vector v.
u
projvu v Figure 1. The projection of u onto v.
In Figure 2, it is clear that the projection of u onto v is some scalar multiple of v; that is, projvu = cv.
(vu)/(vv)*v
ans =
Lets rework formula (2). First, when you multiply a vector by a scalar, it doesnt matter whether you position the scalar before or after the vector.
projv u =
v ¢ u v ¢ v
v
= v
v ¢ u v ¢ v
Next, use the transpose de nition of the inner product followed by the associa- tive property of multiplication. Remember, when performing the dot product, a scalar multiplier may be placed anywhere you wish.
projvu =
vT^ v
v(vT u)
=
vT^ v
(vvT^ )u
vvT vT^ v
u
The expression vvT^ is called an outer product (the transpose operator is outside the product versus its inside position in the inner product). If we de ne
P = vvT vT^ v
, then the projection formula becomes
projvu = P u, where P =
vvT vT^ v
:
The matrix P is called the projection matrix. You can project any vector onto the vector v by multiplying by the matrix P.
Example 5 Let u =
onto v =
and nd P , the matrix that will
project any matrix onto the vector v. Use the result to nd projv u.
First, nd the projection matrix.
vvT vT^ v
Check this result in Matlab.
P=(vv)/(vv)
P =
0.8000 -0. -0.4000 0.
Use this result to nd the projection of u onto v.
projv u = P u
=
Check this last result in Matlab.
P*u
ans =
Note that this is identical to the result in Example 4.
First, use Matlab to generate 100 random vectors and plot them. The following commands will produce an image similar to that in Figure 3.
U=8*rand(2,100)-4; x=U(1,:); y=U(2,:); plot(x,y,o)
(a) Create a matrix P which will project each of the 2 £ 1 vectors in matrix U onto the vector v =
(b) Use the matrix P to project each 2 £ 1 vector in matrix U onto the vector v. Plot the results in a second color. (c) Obtain a printout of your result.
(a) What is the dimension of the column space of P? Check your answer with the ATLAST distributions colbasis command. (b) What is the rank of P? Check your answer with Matlabs rank command.