Given the code :
A = [1 2 3; 3 2 1]
B = A.^2
The output :
B =
1 4 9
9 4 1
But if I do this : B = A^2
The output is :
Error using ^
Inputs must be a scalar and a square matrix.
To compute elementwise POWER, use POWER (.^) instead.
What does the operator .
do exactly ?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…