Data Analysis Write a Porgram
이전 댓글 표시
How to write a program for finding the ortogonal projection of a given vector V1 on another given vector V2??
How should ı do? Which Matlab commands should i use?
댓글 수: 5
Jan
2022년 11월 5일
How would you do this with pencil and paper?
John D'Errico
2022년 11월 5일
Jan's question is the perfect one: I.e., How would you do it on paper, as if you know how to do that, then you can trivially write the MATLAB code. If you don't understand that, then this is surely a homework problem for you, and you need to make an effort.
Mustafa Furkan SAHIN
2022년 11월 6일
Jan
2022년 11월 6일
V1 .* V2 is the elementwise multiplication. You want the dot product instead: V1 * V2.' or dot(V1, V2). Mathematically this can be expressed as sum(V1 .* V2) also.
V1 .^ 2 squares each element, but you want the norm of the vectors: norm(V2)^2. This can be written as sum(V1 .* V1) also.
Try it. There are some different possible commands only, so you can solve this by "gunshot programming": modify the code until the result is as expected.
Mustafa Furkan SAHIN
2022년 11월 6일
편집: Mustafa Furkan SAHIN
2022년 11월 6일
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Programming에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
