How to project given vectors in matlab

4 ビュー (過去 30 日間)
Parmeet Bhogal
Parmeet Bhogal 2017 年 7 月 1 日
編集済み: James Tursa 2017 年 7 月 1 日
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 件のコメント
John D'Errico
John D'Errico 2017 年 7 月 1 日
編集済み: John D'Errico 2017 年 7 月 1 日
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

サインインしてコメントする。

回答 (1 件)

James Tursa
James Tursa 2017 年 7 月 1 日
編集済み: James Tursa 2017 年 7 月 1 日
E.g., see this link
https://en.wikipedia.org/wiki/Vector_projection
u = v2/norm(v2);
result = dot(v1,u)*u;

カテゴリ

Help Center および File ExchangeSoftware Development Tools についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by