From: Natalie Sin Hwee on 19 Jun 2010 14:19 Dear Mathwork users, If i have two matrices, A=magic(3) B=magic(3) a =[8 1 6; 3 5 7; 4 9 2] a = 8 1 6 3 5 7 4 9 2 b =[8 1 6; 3 5 7; 4 9 2] b = 8 1 6 3 5 7 4 9 2 What multiplication method do i use (e.g. cross/dot product) if i want to multiply each element by each element to result in a 3x3 matrix to get: c= [54, 1 36; 9 25 49; 16 81 4] c = 54 1 36 9 25 49 16 81 4 Thank you ^^ Natalie
From: Matt Fig on 19 Jun 2010 14:27 magic(3).*magic(3)
From: John D'Errico on 19 Jun 2010 14:30 "Natalie Sin Hwee " <sin.ng09(a)imperial.ac.uk> wrote in message <hvj1mp$p54$1(a)fred.mathworks.com>... > Dear Mathwork users, > > If i have two matrices, > > A=magic(3) > B=magic(3) > > > a =[8 1 6; 3 5 7; 4 9 2] > a = > 8 1 6 > 3 5 7 > 4 9 2 > > b =[8 1 6; 3 5 7; 4 9 2] > b = > 8 1 6 > 3 5 7 > 4 9 2 > > What multiplication method do i use (e.g. cross/dot product) if i want to multiply each element by each element to result in a 3x3 matrix to get: > > c= [54, 1 36; 9 25 49; 16 81 4] > c = > 54 1 36 > 9 25 49 > 16 81 4 > > > Thank you ^^ > Natalie Well, I don't know of ANY operator that will give you the result you show, since 8*8 = 64, not 54. If perhaps you really meant 64 there, then you might find the .* operator of value. help times John
From: Matt Fig on 19 Jun 2010 14:30 Also, you really should get used to using MATLAB's help facilities. For example, if you had done: docsearch('element-by-element') you would have figured it out!
From: John on 19 Jun 2010 14:59 a.*b and 8 x 8 is 64 "Natalie Sin Hwee " <sin.ng09(a)imperial.ac.uk> skrev i meddelelsen news:hvj1mp$p54$1(a)fred.mathworks.com... > Dear Mathwork users, > > If i have two matrices, > > A=magic(3) > B=magic(3) > > > a =[8 1 6; 3 5 7; 4 9 2] > a = > 8 1 6 > 3 5 7 > 4 9 2 > > b =[8 1 6; 3 5 7; 4 9 2] > b = > 8 1 6 > 3 5 7 > 4 9 2 > > What multiplication method do i use (e.g. cross/dot product) if i want to > multiply each element by each element to result in a 3x3 matrix to get: > > c= [54, 1 36; 9 25 49; 16 81 4] > c = > 54 1 36 > 9 25 49 > 16 81 4 > > > Thank you ^^ > Natalie
|
Pages: 1 Prev: Real Subscript Indices Next: using min to find non-zero minimum |