m****r 发帖数: 141 | 1 【 以下文字转载自 Quant 讨论区 】
发信人: mitcar (mitcar), 信区: Quant
标 题: question about MATLAB matrix squaring
发信站: BBS 未名空间站 (Mon Jul 1 23:53:32 2013, 美东)
A question about MATLAB matrix squaring:
tt = [-2 -1; 0 1]
tt^2
tt^1
tt^3
tt^4
what are the output ? Any why the results are still negative ?
Thanks |
m*********y 发帖数: 1735 | 2 矩阵相乘又不是点乘
negative太正常不过了
【在 m****r 的大作中提到】 : 【 以下文字转载自 Quant 讨论区 】 : 发信人: mitcar (mitcar), 信区: Quant : 标 题: question about MATLAB matrix squaring : 发信站: BBS 未名空间站 (Mon Jul 1 23:53:32 2013, 美东) : A question about MATLAB matrix squaring: : tt = [-2 -1; 0 1] : tt^2 : tt^1 : tt^3 : tt^4
|
m****r 发帖数: 141 | 3 If you make changes to tt, you will find that
tt^2 != tt*tt, what is the operation of tt^2 ?
thanks
【在 m*********y 的大作中提到】 : 矩阵相乘又不是点乘 : negative太正常不过了
|
a******1 发帖数: 2340 | 4 >> tt = [1 -1; -1 1];
>> tt^2
ans =
2 -2
-2 2
>> tt.^2
ans =
1 1
1 1
>> |
l******n 发帖数: 9344 | 5 矩阵乘法
每个元素平方
当然结果不一样
【在 a******1 的大作中提到】 : >> tt = [1 -1; -1 1]; : >> tt^2 : ans = : 2 -2 : -2 2 : >> tt.^2 : ans = : 1 1 : 1 1 : >>
|
d*a 发帖数: 1863 | |
g****a 发帖数: 140 | 7 ^是矩阵乘法: S11= A11*B11+A12*B21 这种
.^是相对应位置相乘 |
m****r 发帖数: 141 | 8 Thanks everyone's reply.
I know the difference between tt^2 and tt.^2.
I want to know why tt^2 != tt*tt ??? (attention: no dot here)
example:
tt= [-1, -2; 1, -1]
tt^2
tt*tt
tt =
-1 -2
1 -1
--> % this is tt^2
ans =
Columns 1 to 1
-1.0000e+000 +0.0000e+000i
-2.0000e+000 +0.0000e+000i
Columns 2 to 2
4.0000e+000 +0.0000e+000i
-1.0000e+000 +-0.0000e+000i
--> this is tt*tt
ans =
-1 4
-2 -1
another example:
tt =
-1 -2
0 -1
--> % this is tt^2
ans =
1 0
0 1
--> % this is tt*tt
ans =
1 4
0 1
Why are they different ?
Thanks
【在 a******1 的大作中提到】 : >> tt = [1 -1; -1 1]; : >> tt^2 : ans = : 2 -2 : -2 2 : >> tt.^2 : ans = : 1 1 : 1 1 : >>
|