m****r 发帖数: 141 | 1 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 |
k*******d 发帖数: 1340 | 2 手算都能算出来的为什么还要拿来版上讨论?。。或者开个Matlab算一算就完啦。。or
, am I missing sth here... |
m****r 发帖数: 141 | 3 I have got all results.
But, I do not know why
tt^2 != tt*tt ?
what is the algorithm of tt^2 ?
or
【在 k*******d 的大作中提到】 : 手算都能算出来的为什么还要拿来版上讨论?。。或者开个Matlab算一算就完啦。。or : , am I missing sth here...
|
c**e 发帖数: 4439 | |
m****r 发帖数: 141 | 5 make some changes to tt,s values, you will see the difference.
【在 c**e 的大作中提到】 : 看到你说不一样 我很惊讶 算了下 是一样的啊
|
m****r 发帖数: 141 | 6 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
【在 c**e 的大作中提到】 : 看到你说不一样 我很惊讶 算了下 是一样的啊
|
k*******d 发帖数: 1340 | 7 This only reason I can think of is you have a corrupted Matlab installation,
or some setting is wrong on your Matlab. Try it on another computer or ask
on the Matlab forum.
【在 m****r 的大作中提到】 : 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
|