Finding the projection on matlab

  • Thread starter Thread starter ver_mathstats
  • Start date Start date
  • Tags Tags
    Matlab Projection
Click For Summary
SUMMARY

The discussion focuses on finding the projection of vector u = (3, -8, 5, 5) onto vector v = (-9, -4, -7, 2) using MATLAB. The user calculates the projection using the formula proj_u_v = dot(u,v)/norm(v)^2*v, resulting in the vector (1.2000, 0.5333, 0.9333, -0.2667). The user then computes the difference u1 = u - proj_u_v and questions how to derive a single value from this operation. The discussion also references the Gram-Schmidt process and suggests using QR factorization for a more comprehensive approach.

PREREQUISITES
  • Understanding of vector projections in linear algebra
  • Familiarity with MATLAB syntax and operations
  • Knowledge of the Gram-Schmidt process
  • Experience with QR factorization techniques
NEXT STEPS
  • Learn MATLAB's symbolic toolbox for generating LaTeX expressions
  • Study the Gram-Schmidt process in detail
  • Explore QR factorization and its applications in linear algebra
  • Practice vector projection calculations in MATLAB with different vectors
USEFUL FOR

Students and professionals in mathematics, engineering, or computer science who are working with vector projections and MATLAB programming.

ver_mathstats
Messages
258
Reaction score
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
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)
 

Similar threads

  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 10 ·
Replies
10
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 32 ·
2
Replies
32
Views
5K
Replies
0
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 4 ·
Replies
4
Views
3K