|
|
|
|
|
Orthogonal Projections
How to Examples Exercise How to: Here, we will start with some unit vector, u. A unit vector is one whose length is one. For now, we really only know how to find length in the 2nd-dimension, but other dimensions are quite similar (length = sqrt((Xone - 0)^2 + Xtwo^2 + ... + Xnth^2)). So, extending our unit vector, u, to infinity in both directions, gives us a line, L, which consists of all scalar multiples of u. Now, we have some other vector, v, which is not on the line, L, (otherwise the projection would be trivial). We want to find the orthogonal projection onto L, which we will call projLv (which we'll read as the projection of v onto L). This means that the vector v - projLv would be perpendicular to L, OR that we are forming a right triangle with v as the hypotenuse, projLv as a leg, and v - projLv as the other leg. To find projLv in MATLAB we type: projLv = dot(u, v)*u Since the dot protect returns a scalar, you can see that projLv is just some scalar multiple of u. Examples: For our example, let's work in the 2nd dimension. We'll start with a unit vector, u = [1; 0] and another vector, v = [3; 5]. If you want to imagine our line, L, we just extend u infinitely in both directions, in this case, it would be the entire X-axis. Now, to find our orthogonal projection, projLv, we input: projLv = dot(u, v)*u MATLAB quicky outputs that projLv = [3; 0]. Exercise: |