运算符“点"是什么意思(.) 意思是? [英] What does operator "dot" (.) mean?
本文介绍了运算符“点"是什么意思(.) 意思是?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
给出代码:
A = [1 2 3; 3 2 1]
B = A.^2
输出:
B =
1 4 9
9 4 1
但是,如果我这样做:B = A^2
But if I do this : B = A^2
输出为:
Error using ^
Inputs must be a scalar and a square matrix.
To compute elementwise POWER, use POWER (.^) instead.
运算符.
的确切作用是什么?
What does the operator .
do exactly ?
推荐答案
点本身不是运算符,.^
是.
The dot itself is not an operator, .^
is.
.^
是逐点¹(即逐元素)的幂,因为.*
是按点积.
The .^
is a pointwise¹ (i.e. element-wise) power, as .*
is the pointwise product.
.^
阵列电源.A.^B
是具有B(i,j)
次幂的元素A(i,j)
的矩阵.A
和B
的大小必须相同或兼容.
.^
Array power.A.^B
is the matrix with elementsA(i,j)
to theB(i,j)
power. The sizes ofA
andB
must be the same or be compatible.
C.f.
- 数组与矩阵运算": https://mathworks.com/help/matlab/matlab_prog/array-vs-matrix-operations.html
- "Pointwise": http://en.wikipedia.org/wiki/Pointwise
- 元素明智的操作": http://www.glue.umd.edu/afs/glue.umd.edu/system/info/olh/Numerical/Matlab_Matrix_Manipulation_Software/Matrix_Vector_Operations/elementwise
- "Array vs. Matrix Operations": https://mathworks.com/help/matlab/matlab_prog/array-vs-matrix-operations.html
- "Pointwise": http://en.wikipedia.org/wiki/Pointwise
- "Element-Wise Operations": http://www.glue.umd.edu/afs/glue.umd.edu/system/info/olh/Numerical/Matlab_Matrix_Manipulation_Software/Matrix_Vector_Operations/elementwise
¹)因此是点.
这篇关于运算符“点"是什么意思(.) 意思是?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文