How to project given vectors in matlab

4 Ansichten (letzte 30 Tage)
Parmeet Bhogal
Parmeet Bhogal am 1 Jul. 2017
Bearbeitet: James Tursa am 1 Jul. 2017
v1 = [1.12;2.10;7.03;4.15;6.13] v2 = [1;-1.01;1.02;-1.03;1.04]
I need to calculate projection of v1 onto v2 how would I code this into matlab?
  1 Kommentar
John D'Errico
John D'Errico am 1 Jul. 2017
Bearbeitet: John D'Errico am 1 Jul. 2017
A dot product.
https://math.oregonstate.edu/home/programs/undergrad/CalculusQuestStudyGuides/vcalc/dotprod/dotprod.html
help dot
You will need the norm of the vector v1.
help norm

Melden Sie sich an, um zu kommentieren.

Antworten (1)

James Tursa
James Tursa am 1 Jul. 2017
Bearbeitet: James Tursa am 1 Jul. 2017
E.g., see this link
https://en.wikipedia.org/wiki/Vector_projection
u = v2/norm(v2);
result = dot(v1,u)*u;

Kategorien

Mehr zu Software Development Tools finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by