square of a vector
6 ビュー (過去 30 日間)
古いコメントを表示
I have to calculate a square of vector which should results a scalar value. i.e) A=(B-C)^2 B and C are vectors and I need A as a scalar. How can I implement this in matlab??
0 件のコメント
採用された回答
Honglei Chen
2012 年 10 月 31 日
編集済み: Honglei Chen
2012 年 10 月 31 日
My guess is you need an inner product, i.e. A = |B-C|^2, you can do it many different ways, one way is
B = ones(3,1);
C = ones(3,1);
A = (B-C)'*(B-C)
その他の回答 (1 件)
参考
カテゴリ
Help Center および File Exchange で Loops and Conditional Statements についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!