
From:  pben 
Subject:  Re: Very basic question 
Date:  Wed, 30 Jul 2003 15:51:02 0500 
Hello Uli,
You are running into a fundamental issue with matrices.
If you multiply matrix A by matrix B, then their "inner" dimensions must be the same. That is, the number of columns in A must equal the number of rows in B.
If what you want is the "inner product" or "dot product" of two _vectors_, then you must stay aware as to whether the vectors are row or column vectors (actually in Octave and Matlab there are no vectors, just matrices made with a single row or single column).
You could get a result using a transpose
a * b'
Then the results would be 1*1+2*2+3*3=14
Or you could get a result using an element by element multiply
a .* b
Then the result would be a 1 x 3 (1 row, 3 cols) equal to [ 1*1 2*2 3*3] = [1 4 9]
Hope this helps,
Ben
Ulrich Grassberger <address@hidden>
07/30/2003 03:42 PM  To: Octave mailing list <address@hidden> cc: Subject: Very basic question 
[Prev in Thread]  Current Thread  [Next in Thread] 