Path: news.mathworks.com!not-for-mail
From: "Ulrik Nash" <uwn@sam.sdu.dk>
Newsgroups: comp.soft-sys.matlab
Subject: Matrix multiplication
Date: Mon, 6 Sep 2010 13:44:05 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 19
Message-ID: <i62r75$4ge$1@fred.mathworks.com>
Reply-To: "Ulrik Nash" <uwn@sam.sdu.dk>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1283780645 4622 172.30.248.37 (6 Sep 2010 13:44:05 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 6 Sep 2010 13:44:05 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 2106050
Xref: news.mathworks.com comp.soft-sys.matlab:667914

Hi Everyone,

Suppose I have a matrix A:

A = [1 2;3 4;5 6]

and B:

B = [1 2]

What I would like is to form a matrix C, by multiplying the first column in A by the first column in B, and the second column in A by the second column i B to obtain:

C = [1 4;3 8;5 12]

I have tried C = B.*A but this does not work, because the dimensions do not match. But is there not a simple operation, that allows me to form C?

Regards,

Ulrik.