From: nick on 27 Jun 2010 17:12 Hi all, Could someone please give me a hand for this simple question? I want to multiply colum by colum of the two matrices. For example: matrix X has the size (4,3) and matrix Y has the size (1,3). Is there any single Matlab command to produce a matrix Z in the following format: Z = [X(:,1)*Y(1) X(:,2)*Y(2) X(:,3)*Y(3)] Thanks heap for your inputs. Nick
From: Faraz Afzal on 27 Jun 2010 21:37 nick <nghiango79(a)gmail.com> wrote in message <1124078130.14069.1277687570117.JavaMail.root(a)gallium.mathforum.org>... > Hi all, > > Could someone please give me a hand for this simple question? > > I want to multiply colum by colum of the two matrices. > > For example: matrix X has the size (4,3) and matrix Y has the size (1,3). Is there any single Matlab command to produce a matrix Z in the following format: > > Z = [X(:,1)*Y(1) X(:,2)*Y(2) X(:,3)*Y(3)] > > Thanks heap for your inputs. > > Nick Hey Nick To my knowledge there is none. You can make use of a for loop and save it in an mfile , therby u can achieve it in one command. You know how to generalize it with for loop..don't you ? Regards Faraz
From: Roger Stafford on 27 Jun 2010 21:46 nick <nghiango79(a)gmail.com> wrote in message <1124078130.14069.1277687570117.JavaMail.root(a)gallium.mathforum.org>... > Hi all, > > Could someone please give me a hand for this simple question? > > I want to multiply colum by colum of the two matrices. > > For example: matrix X has the size (4,3) and matrix Y has the size (1,3). Is there any single Matlab command to produce a matrix Z in the following format: > > Z = [X(:,1)*Y(1) X(:,2)*Y(2) X(:,3)*Y(3)] > > Thanks heap for your inputs. > > Nick Z = bsxfun(@times,X,Y); Roger Stafford
From: nick on 27 Jun 2010 19:21 This is what I am looking for. Thanks very much Roger.
From: Steve Amphlett on 28 Jun 2010 04:52 nick <nghiango79(a)gmail.com> wrote in message <1489283667.14448.1277695292924.JavaMail.root(a)gallium.mathforum.org>... > This is what I am looking for. Thanks very much Roger. Before bsxfun there was repmat. Before repmat there was ones.
|
Next
|
Last
Pages: 1 2 Prev: Creating a matrix from arrays generated in for-loop Next: graph allshortest paths |