vector sum and magnitude
古いコメントを表示
I need to create a function that will take two 3D geometric vectors as its arguments, sums them, and returns the resultant vector and its magnitude
2 件のコメント
Geoff
2012 年 5 月 16 日
And your question is ..... ?
Aakash Deep
2018 年 6 月 1 日
Your statement is contradicting. If the values are in 1 dimension then it is a vector, if the values are in 2 dimensions then it is a matrix and if the values are in 3 or more dimensions then it is a tensor. So, 3D vector does not make any sense.
回答 (1 件)
Geoff
2012 年 5 月 16 日
Maybe this will help:
function [vec, mag] = DoMyHomeworkForMe( v1, v2 )
% Your calculation goes here
end
10 件のコメント
Robert
2012 年 5 月 16 日
Robert
2012 年 5 月 16 日
Geoff
2012 年 5 月 16 日
That WAS a push in the right direction. =P All you need to do is add your vectors together and find out how big the result is.
Robert
2012 年 5 月 16 日
Geoff
2012 年 5 月 16 日
Now we're going round in circles! Please see the code in my answer. The INPUTS are v1 and v2; the OUTPUTS are vec and mag. I think the names a self-explanatory here. You don't have to use the function name that I used.
Robert
2012 年 5 月 16 日
Geoff
2012 年 5 月 16 日
x = [1, 2, 3];
y = [2, 2, 2];
Robert
2012 年 5 月 16 日
Geoff
2012 年 5 月 16 日
You're kidding... copy that exact code I wrote declaring two vectors (x and y) and paste it into MatLab.
Robert
2012 年 5 月 16 日
カテゴリ
ヘルプ センター および File Exchange で MATLAB についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!