Finding the projection on matlab

In summary, the conversation discusses finding the norm of the vector u-proj_vu, where u = (3, -8, 5, 5) and v = (-9, -4, -7, 2). The solution involves using the dot product and norm of v to find the projection of u onto v, and then subtracting it from u to obtain u1. The final step is to take the dot product of u1 and the projection vector to find the norm.
  • #1
ver_mathstats
260
21

Homework Statement



Let u = (3, -8, 5, 5) and v = (-9, -4, -7, 2). Find ||u − projvu||.

Homework Equations

The Attempt at a Solution


>> u=[3 -8 5 5]

u =

3 -8 5 5

>> v=[-9 -4 -7 2]

v =

-9 -4 -7 2

>> proj_u_v = dot(u,v)/norm(v)^2*v

proj_u_v =

1.2000 0.5333 0.9333 -0.2667

>> u1 = u - proj_u_v

u1 =

1.8000 -8.5333 4.0667 5.2667

>> dot(u1,proj_u_v)

ans =

2.2204e-16

This is what I have obtained so far, I'm not sure if I am looking for one value and how to obtain that one value?

Thank you.
 
Physics news on Phys.org
  • #2
In terms of formatting, can you use the "plus" sign to insert code -> general code. It would make things a lot more legible. As for the openning line of your post, if you have the symbolic expression toolbox, MATLAB can create LaTeX for you e.g. see here:

https://www.mathworks.com/help/symbolic/latex.html
https://www.mathworks.com/matlabcen...it-possible-to-output-expressions-using-latex
- - - -
As for your post, the relevant equation here is Gramm Schmidt, right?

ver_mathstats said:
>> proj_u_v = dot(u,v)/norm(v)^2*v
This is close to Gramm Schmidt, but not quite right... why?

(Alternatively you could collect the vectors in matrix and run QR factorization if you're familiar with such a thing)
 

1. How do I find the projection of a vector on Matlab?

To find the projection of a vector on Matlab, you can use the "proj" function. This function takes in two input vectors, the vector you want to project and the vector you want to project onto, and returns the projection vector. For example, if you have a vector A and want to project it onto a vector B, you would use the syntax "proj(A,B)".

2. Can I find the projection of a matrix on Matlab?

Yes, you can find the projection of a matrix on Matlab by using the "proj" function with the appropriate input matrices. The function will return a matrix with the same dimensions as the input matrix.

3. How do I plot the projection of a vector on Matlab?

To plot the projection of a vector on Matlab, you can use the "plot" function. First, use the "proj" function to find the projection vector. Then, use the "plot" function with the original vector and the projection vector as inputs. This will create a plot showing the original vector and its projection onto the other vector.

4. Can I find the angle between a vector and its projection on Matlab?

Yes, you can find the angle between a vector and its projection on Matlab by using the "dot" function. This function takes in two vectors and returns the dot product, which can be used to calculate the angle between the two vectors. You can also use the "acos" function to convert the dot product into an angle in radians or degrees.

5. Are there any other functions I can use to find the projection on Matlab?

Yes, there are other functions you can use to find the projection on Matlab, such as the "orth" function and the "null" function. These functions can be useful for finding the projection onto a subspace or for finding the orthogonal complement of a vector. It is recommended to explore the documentation and examples of these functions to determine which is most appropriate for your specific problem.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
4
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
10
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
0
Views
523
  • Engineering and Comp Sci Homework Help
Replies
32
Views
3K
  • Engineering and Comp Sci Homework Help
Replies
8
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
12
Views
1K
  • Precalculus Mathematics Homework Help
Replies
2
Views
434
  • Nuclear Engineering
Replies
7
Views
2K
Back
Top