Projection and distance of vectors - MATLAB
Show older comments
Hello,
I have two questions. For example I have two vectors u and v, and:
- I have to calculate the distance between vectors u and v
- I have to find the projection of u onto the line spanned by v
I have some ideas for the first one, dist(u-v) or just (u-v) but I am not sure if it is correct.
And for the second question I found the command in matlab that I could do it like this u=orth(v)
Can you please advise me if I am heading towards the right direction or am I completely clueless. :)
Thank you in advance Nina
Accepted Answer
More Answers (4)
Roger Stafford
on 8 Jan 2013
dot(u,v)*v/norm(v)
Lea Nina
on 8 Jan 2013
0 votes
1 Comment
Image Analyst
on 8 Jan 2013
if one "vector" goes from 2,2 to 3,3 and the other vector goes from 11,11 to 15,15, do those vectors have a projection? Or do all your vectors have their tails at the same location? Is the "distance" between the vectors, the distance between their tips?
Categories
Find more on MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!