What is the meaning of symbol “.”in this code
2 ビュー (過去 30 日間)
古いコメントを表示
採用された回答
Jan
2022 年 3 月 16 日
編集済み: Jan
2022 年 3 月 16 日
While ^ is the power operation, which acts on the complete array, .^ is the elementwise power. For a scalar, this is no difference:
a = 17;
a ^ 2 % 289, same as a * a
a .^ 2 % 289, same as a * a
a = [2, 3];
a ^ 2 % ERROR, same as [2, 3] * [2, 3] - this is not defined
a .^ 2 % [4, 9], same as [2^2, 3^2]
% And equivalent to: a .* a
The power operator ^ is defined for square matrices only.
The same for .* : * multiples the arrays, while .* operates on the array elements.
0 件のコメント
その他の回答 (1 件)
参考
カテゴリ
Help Center および File Exchange で Matrix Indexing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!