Suppose I have a matrix:
A = [ a, b, c; d, e, f ]; and a vector:
b = [ x; y; z ]; What I want is resultant matrix as:
C = [ a*x, b*y, c*z; d*x, e*y, f*z ]; How can I do this? Essentially, I want to multiply matrix (dimension: mxn) with a vector (nx1) and get resultant matrix mxn.
As requested in comments (using octave version 3.8.0):
octave> A = [ 1,2,3;4,5,6]; B=[10;20;30]; octave> A*B ans = 140 320 octave> A.*B error: product: nonconformant arguments (op1 is 2x3, op2 is 3x1) octave> bsxfun(@times, A, B) error: bsxfun: nonconformant dimensions: 2x3 and 3x1
.*. If you're using MATLAB ≤ R2016a, you will needbsxfun. In Octave and MATLAB ≥ R2016b, you can directly use.*(after adjusting the dimensions)'is complex conjugate transpose. You should be using simple transpose.'here because it is transpose that you're meant to take. Andy has already posted it. You can go ahead with it.