Hi, When I multiply a and b
a=[1 -2 0; 3 2 1; -2 1 3];
b=[4, -2 3;-1 5 0;6 1 2];
I get this answer
ans =
6 -12 3
16 5 11
9 12 0
The second row appears to be incorrect. When I do it by hand, the second row becomes [4 3 7]
I'm new to Matlab; is my syntax ok?

 採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 5 月 1 日
編集済み: Azzi Abdelmalek 2013 年 5 月 1 日

3 投票

I think you are doing something wrong by hand. The result
6 -12 3
16 5 11
9 12 0
is correct

5 件のコメント

Poon
Poon 2013 年 5 月 1 日
My hand calculated answer matches the answer in the book. This is what I did. I used the same procedure and rows 1 and 3 match my answers. Please correct me if I did it wrong.
For row 2:
3*4+2*-1+-1*6 3*-2+2*5+-1*1 3*3+2*0+-1*2 = [4 3 7]
Azzi Abdelmalek
Azzi Abdelmalek 2013 年 5 月 1 日
This is wrong, It's
[3*4+2*(-1)+1*6 3*(-2)+2*5+1*1 3*3+2*0+1*2]
Matt J
Matt J 2013 年 5 月 1 日
Why -1*6?
a(2,3)=+1 and b(3,1)=+6, so the first element is
(3*4)+(2*-1)+(1*6) = 16
Poon
Poon 2013 年 5 月 1 日
You're right. I left out one negative sign. I'm new to matrices so it's hard for me to figure out where the problem may lie. It's funny how you can compare the entered matrices with what's printed on the paper a dozen time and still not see the missing negative sign. Thank you for your help.
Walter Roberson
Walter Roberson 2013 年 5 月 1 日
16 5 11 as the second row is the same answer that Maple gets.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by